I attempted to run the program that plays mastermind, here:
http://www.python-course.eu/mastermind.php
To do so, I installed python3.4.3 first.
I ran the program, but it returned:
Traceback (most recent call last):
File "mastermind_p1_trim.py", line 5, in <module>
from combinatorics import all_colours
ImportError: No module named 'combinatorics'
So I navigated to https://pypi.python.org/pypi/Combinatorics
and downloaded it, then ran python3
python3 setup.py install
from within the Directory downloaded.
This returned
Writing /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Combinatorics-1.4.5-py3.4.egg-info
finally, sys.path returns
['', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages']
when running python3.
So, I do not know why I am still receiving the error,
ImportError: No module named 'combinatorics'
I have looked at other similar pages on SO, but the suggestions there do not seems to solve my problem. Could anyone help me figure this out?
Combinatorics might not be compatible with Python 3.4.3
Here are some suggestions:
Un-install Python 3.4.3 and all it's resources
Install python 2.7
Install combinatorics
Read more in detail
Here is a guide from ActiveState:
Download and install ActivePython
[IGNORE THIS] Buy and install the Business Edition license from account.activestate.com
Open Command Prompt
Type pypm install combinatorics
Related
I have recently bought a new laptop and was viewing some python projects of mine which I made on my pc. For one of them I use the python-bitvavo-api library which I installed using pip3 install python-bitvavo-api. The version I installed is 1.2.2 which is the latest on their website.
Now when I try to import it using this code: from python_bitvavo_api.bitvavo import Bitvavo, I get the following error:
Traceback (most recent call last):
File "C:\Users\indig\OneDrive\Documenten\Python Projects\Personal\Cryptone\Cryptone.py", line 6, in <module>
from python_bitvavo_api.bitvavo import Bitvavo
ModuleNotFoundError: No module named 'python_bitvavo_api'
I read online that it may occur when using multiple python versions, Im only using 1 and thats python 3.7
Btw. I have the same error with the Pillow module, so it might be a setting in visual studio that I dont know of. Anyway, someone please help. If you need more details please ask.
How are you running it? From the terminal or from VS?
You can also check the installed libraries running the command pip list
I am trying to install a software called p4vasp:
https://github.com/orest-d/p4vasp/blob/master/README.MacOS.
I am getting this error message:
You need to get version 2.0 (or later) of PyGTK for this to work. You can get source code from http://www.pygtk.org
So I go there and follow the steps, but when I try to run the python script hello.py it fails:
File "hello.py", line 1, in
import gi
ImportError: No module named gi.
I think this could the problem.
pygobject3 3.36.1 is already installed and gtk+3 3.24.22 as well.
I have tried all the solutions, none worked so far.. Could someone help me please?
Thank you in advance.
Best wishes to all
so i've recently installed pygame because i want to start programming with it. Before writing code, i decided to just make sure its running fine by testing it in IDLE.
i ran
import pygame
no error
i ran
pygame.init()
and got the following error
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
pygame.init()
AttributeError: module 'pygame' has no attribute 'init'
by doing some research i found out that it may be messing up the path, so i tried
pygame._path_
and got a similar error
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
pygame._path_
AttributeError: module 'pygame' has no attribute '_path_'
and i can't figure out whats wrong. i've tried solutions in other questions but nothing works
im using
Windows 10 Home
Python 3.5.2 32 Bit
Pygame 1.9.2a0 for python 3.2 (but after looking up if it would work with python 3.5, i found resources saying it would)
i tried installing the 3.5 version as a .whl but it had its own host of problems and just decided to use the installer. is the error because of the mismatch between python versions and pygame versions, or is there something else i can try?
I have tried the following
pygame._path_
there is nothing else named pygame.py that would confuse the path
i used the installer
i made sure there were no other versions of python/pygame installed
So are there any other solutions beyond the ones that i have tried to get this one working?
Thank you for your time.
EDIT 1: I have made sure that the only directory named pygame is the module.
to finding the pygame path:
Magic methods have two underscores on either side of them.
to the lack of pygame.init():
different software seem to be able to find different parts of pygame, because PyCharm cannot locate that function, but when running off the command line it operates perfectly. It may just be a fault of idle. Try running from the command line or double clicking the .py file, assuming it is associated with the interpreter. If that doesn't work, run the command
python -m pip install --upgrade pygame
Have you installed pygame correctly.
Put this in your cd (command prompt) to check if you have installed pygame properly
py -m pygame.examples.aliens
If it gives a error then you should use the pip install function
py -m pip install -U pygame --user
If everything fails you can install an IDE. I would recommend pycharm https://www.jetbrains.com/pycharm/download/#section=windows
It is a free IDE and you can install pygame from there for a project
File --> Settings --> Project:(Name) --> Project Interpreter --> pip --> type pygame and install package.
Pycharm pygame installation
I'm using Ubuntu 12.04 and installed python-nmap to create a script. If I use IDLE and type in the following, it runs fine:
import nmap
nm = nmap.PortScanner()
nm.scan('127.0.0.1', '22-443')
However, if I perform this in Eclipse, I receive the following error:
Traceback (most recent call last):
File "/home/russ/workspace/ViPyNmap/MyFiles/nmaptest.py", line 2, in <module>
nm = nmap.PortScanner()
AttributeError: 'module' object has no attribute 'PortScanner'
I've added the egg file and also the folder to the Eclipse path for the project, with no luck. I've also restarted Eclipse after doing so, with no luck. I apologize for my inexperience with both Eclipse and Python and appreciate the help.
You likely installed the package "nmap", not "python-nmap":
So, just uninstall "nmap" and install "python-nmap":
pip uninstall nmap
pip install python-nmap
1 analyzing
If you see the source code nmap.py at directory /usr/local/lib/python2.7/dist-packages/nmap/, you will find that there is not class PortScanner.
2 solution
2.1 method one
You should delete the directory .../nmap/ with contained files, and install the new the packages nmap or bypython setup.py install at new packages directory.
2.2 method two
You also can copy the file nmap.py at the new packages to your directory .../MyFiles/ with your py file nmaptest.py, and run your command python nmaptest.py.
good luck for you !
The reason why this is happening is because your module that you named nmap.py is now shadowing the intended requests module you are trying to use.
To avoid this, you should rename your module to something else to avoid these situations. Furthermore, chances are you will have generated a nmap.pyc file as well, local to where your nmap.py resides. Make sure you remove that as well after your rename, as the interpreter will still reference that file, re-producing the error.
Example of problem resolution:
renaming file to nmapscan.py, removing nmap.pyc and running again.
Well above answers are working fine in python 2.7, but when we are working in python3 environment following will help to resolve it
pip uninstall nmap
pip uninstall python-nmap
pip3 install python-nmap
I'm getting an error whilst trying to install psycopg2 on ubuntu 9.10 64 bit.
The error is:
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "psycopg2/__init__.py", line 69, in <module>
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: psycopg2/_psycopg.so: undefined symbol: PyUnicodeUCS2_Decode
I've tried downloading the package from http://initd.org/pub/software/psycopg/ and installing it. I've tried by using easy_install too.
No error during the installation.
It's quite weird as my python (2.6.2) has been compiled with UCS4 and so the installation should just work without problems.
Any help would be appreciated.
Cheers
fixed it.
I had to recompile python with --enable-unicode=ucs4.
Still not clear why as the default version on ubuntu uses ucs4.
Like you say, your Python has been built UCS4. But the psycopg2 you're trying to install has been built against a Python built UCS2. Find one or build one against UCS4.
I had the same error when importing bx.intervals from bx-python:
undefined symbol: PyUnicodeUCS2_Decode
However, the python version I was using was already compiled with ucs4. Apparently, bx-python was built against a python version that was compiled with ucs2. So I had to recompile python in the opposite way described by the OP: ./configure --enable-unicode=ucs2.
In my case, using bash shell I had no issue and with csh faced this issue. Realized have multiple version of python installed. one defaulting in /usr/local/bin worked vs one in /bin exhibited the issue. Point being before you think you need to recompile with admin help check if you have any alternate version of python installed.