Errors by installing Python modules Pygame and Pygame Zero - python

I've succesfully installed Python version 3.8.1 and also PIP.
After that i want to install Pygame and Pygame Zero with the commands
pip install pygame
or
pip install pgzero
But I get the following error:
C:\>pip install pygame
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python38\Scripts\pip.exe\__main__.py", line 9, in <module>
TypeError: 'module' object is not callable
Also with the --user command it doesn't succeed:
pip install pygame --user
or
pip install pgzero --user
What am I doing wrong here now?

I also got that problem long ago.
You can try this:
pip uninstall pygame
pip uninstall pgzrun
then download it by:
pip install pygame
pip install pgzrun

Info of your assets are little low.. But if you have Python 2 and 3, try manage your alias on CMD by checking your current python variables from /usr/bin and from CMD type "python --version" to see current default. If it says Python2.7 you can chance that with "alias" command below (reason to do that, is 2.7 support is ending 1.1.2020 and old pip for it too. So in future, you should upload new modules just for Python3.7). If you have 2.7 in your PC and you have been using it for some time, you should not try to remove it.
So just in case:
$ alias python="/usr/bin/python3.7"
Then use command
$ sudo pip3 install pygame
This should work. If not, there is some setting problems on your module site.
Give a hit with this and if it doesn't work, let us know. I can give instruction to get it to work. It requires few steps at (in my case:)
/home/usr/Python-3.7.4/Modules/Settings.
It can (I'm not sure with these modules but..) require to set SSL connection too, but it can be done from there too, without any coding.

Thank you for the quick arswers!
It is succeeded by giving the commands:
py -3 -m pip install pygame --user
py -3 -m pip install pgzero --user
The only warnings i got by installing pgzero were:
Collecting pgzero
Downloading .....
Installing collected packages: numpy, pgzero
WARNING: The script f2py.exe is installed in 'C:\Users\Han\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script pgzrun.exe is installed in 'C:\Users\Han\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.18.0 pgzero-1.2

Oh.. I didn't know, you are using Windows.. My last answer dried down with that. It was for Linux.
Either way, when you installed python, did you mark the PATH in installation process?
It shows when installation windows pops up.
I'm little noob with windows, but I expect it to be as same as in any operation systems.
If you didn't, its easier to remove Python and install it again, than try to mark the PATH after installing. After all its just 1/2 min job.

Related

Tried to install PyQt5-tools via pip, didn't work [duplicate]

A program I am trying to install requires the installation of PyQt5 5.15.0 , which gives me this error. The odd thing is that the installation works fine for the latest version of PyQt5 (5.15.2), but this program requires 5.15.0 specifically.
Command Output:
Collecting PyQt5==5.15.0
Using cached PyQt5-5.15.0.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6'
cwd: C:\Users\mshal\AppData\Local\Temp\pip-install-sfw90hvc\pyqt5_e2cc46859b554da7b84798abae5378ba
Complete output (31 lines):
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 126, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 479, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\project.py", line 79, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 225, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6' Check the logs for full command output.
I am on the latest version of pip. Any ideas on the root cause of this issue?
What helped me is upgrading pip from 20.2.3 to the latest one (in my case 21.1.1)
For Mac/Homebrew users.
The answer by #the-x is leading in the right direction. On a Mac with QT5 installed via Homebrew the qmake binary just needs to be added to the path. This can be achieved through
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
(of course depending on where the homebrew files are installed)
Running on arm with python3.6 (ubuntu18 on nvidia Xavier):
sudo apt install qt5-default
For MacOS users.
I am on Apple M1 silicon using Python 3.9.8. What worked for me was #Apaul's comment in the original question section. Install pyqt5-sip prior to pyqt5.
I also have an Intel Mac and on that machine, I do not need to do this.
Checking the binaries that PyQt5 provides in pypi for version 5.15.0 I see that it does not provide the binaries for python3.9 in windows, so pip is trying to compile using the source code which is complicated and can generate several dependency problems (for example you must have Qt 5.15 installed, etc). So my recommendation is to install a more updated version of PyQt5, for example 5.15.2 since if it provides the binaries for python3.9 on windows, in addition to being a wrapper of an LTS version of Qt then it will have solved several bugs.
python -m pip install PyQt5==5.15.2
Another solution is to use python3.8 instead of python3.9 so that you can install pyqt5 5.15.0 from pypi without problems.
Upgrading your pip enables you to install PyQt5. Personally, I had the same issue while installing PyQt6 and I upgraded my pip, and everything installed perfectly. I think both python and pip versions play an important role in installing PyQt so make sure you have later versions.
This is the command I used in Linux:
pip install --upgrade pip
Combining several answers on this question: On an Apple M1 Pro Macbook with macOS Ventura 13.0.1, with Homebrew 3.6.17 and python 3.11.0 the following commands fixed it for me (no sudo):
brew install qt5
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
python3 -m ensurepip --default-pip
pip3 install pyqt5-sip
pip3 install pyqt5 --config-settings --confirm-license= --verbose
That last step calls qmake to compile all of Qt on your M1 and takes many minutes to complete, be patient and let it finish.
Since qt5-default was not available, I installed qt5-default's dependencies
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
after that I installed pyqt5 via apt-get first and afterwards via pip
sudo apt-get install pyqt5-dev
pip install pyqt5
now wheel seems to work
side-note:
I am not sure if sudo apt-get install pyqt5-dev is even necessary
The error message thrown here is misleading - it's not an issue with a sipbuild.api attribute. Indeed, in this case program qmake is missing, see last line of the Python traceback. Have a look if it's installed on your system and add it to your PATH variable. Otherwise, install it. On Linux this would be done with
sudo apt-get install qt5-qmake
I had this problem on my M1 Mac using Python 3.9.12 when I was trying to install a library: pip install pixellib.
The first thing I did was: pip install pixellib --verbose to see the whole log, and there I noticed that PyQt5 was waiting for an input. So then I found someone else with that issue, and used pip install pyqt5 --config-settings --confirm-license= --verbose which took some time to compile, but worked!
I could not get any of the above solutions to work but I managed to get it working using python3.9, PyQt5=5.15.2, pip=22.0.2 and sip=6.5.0 by using sudo apt-get install PyQt5. If you need it in a virtual environment, you can manually copy the PyQt5 folder from your default /usr/lib/python3/dist-packages to the site-packages folder in your virtual environment.
To all those that are struggling with Apple M1 installation, here is a working solution, specifically addressing the problem of installing the pixellib library that depends on PyQt5 but you can apply it equally to other libs:
PyQt5 is not supported on Apple M1, it needs qt6: https://www.reddit.com/r/learnpython/comments/o4w1ut/comment/h2jele3/?utm_source=share&utm_medium=web2x&context=3 , https://www.qt.io/product/qt6
this means you need to install PyQt6: python3 -m pip install PyQt6
go to the lib you need, in my case pixellib: https://pypi.org/project/pixellib/#files and
download the wheel file
get the wheel tool: pip install wheel
unpack the wheel wheel unpack pixellib-0.7.1-py3-none-any.whl
Change its dependency of PyQt5 to PyQt6
edit pixellib-0.7.1/pixellib-0.7.1.dist-info/METADATA
pyQt5 => pyQt6
pack it back wheel pack pixellib-0.7.1
install it: pip install pixellib-0.7.1-py3-none-any.whl
test in python: `
# should work
import pixellib
P.S. thanks to Terra and ChaOS for supporting work on the project underlying this report.
I finally managed to make it works on M1/M2 Macbook Pro.
None of these answers worked for me, so I looked at brew to install pyqt.
The following command will install pyqt5 via brew:
brew install pyqt#5
Then it just worked.
This can be resolved by switching to an environment with Python >= 3.8

AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel' for PyQt5 5.15.0

A program I am trying to install requires the installation of PyQt5 5.15.0 , which gives me this error. The odd thing is that the installation works fine for the latest version of PyQt5 (5.15.2), but this program requires 5.15.0 specifically.
Command Output:
Collecting PyQt5==5.15.0
Using cached PyQt5-5.15.0.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6'
cwd: C:\Users\mshal\AppData\Local\Temp\pip-install-sfw90hvc\pyqt5_e2cc46859b554da7b84798abae5378ba
Complete output (31 lines):
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 126, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 479, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\project.py", line 79, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 225, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6' Check the logs for full command output.
I am on the latest version of pip. Any ideas on the root cause of this issue?
What helped me is upgrading pip from 20.2.3 to the latest one (in my case 21.1.1)
For Mac/Homebrew users.
The answer by #the-x is leading in the right direction. On a Mac with QT5 installed via Homebrew the qmake binary just needs to be added to the path. This can be achieved through
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
(of course depending on where the homebrew files are installed)
Running on arm with python3.6 (ubuntu18 on nvidia Xavier):
sudo apt install qt5-default
For MacOS users.
I am on Apple M1 silicon using Python 3.9.8. What worked for me was #Apaul's comment in the original question section. Install pyqt5-sip prior to pyqt5.
I also have an Intel Mac and on that machine, I do not need to do this.
Checking the binaries that PyQt5 provides in pypi for version 5.15.0 I see that it does not provide the binaries for python3.9 in windows, so pip is trying to compile using the source code which is complicated and can generate several dependency problems (for example you must have Qt 5.15 installed, etc). So my recommendation is to install a more updated version of PyQt5, for example 5.15.2 since if it provides the binaries for python3.9 on windows, in addition to being a wrapper of an LTS version of Qt then it will have solved several bugs.
python -m pip install PyQt5==5.15.2
Another solution is to use python3.8 instead of python3.9 so that you can install pyqt5 5.15.0 from pypi without problems.
Upgrading your pip enables you to install PyQt5. Personally, I had the same issue while installing PyQt6 and I upgraded my pip, and everything installed perfectly. I think both python and pip versions play an important role in installing PyQt so make sure you have later versions.
This is the command I used in Linux:
pip install --upgrade pip
Combining several answers on this question: On an Apple M1 Pro Macbook with macOS Ventura 13.0.1, with Homebrew 3.6.17 and python 3.11.0 the following commands fixed it for me (no sudo):
brew install qt5
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
python3 -m ensurepip --default-pip
pip3 install pyqt5-sip
pip3 install pyqt5 --config-settings --confirm-license= --verbose
That last step calls qmake to compile all of Qt on your M1 and takes many minutes to complete, be patient and let it finish.
Since qt5-default was not available, I installed qt5-default's dependencies
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
after that I installed pyqt5 via apt-get first and afterwards via pip
sudo apt-get install pyqt5-dev
pip install pyqt5
now wheel seems to work
side-note:
I am not sure if sudo apt-get install pyqt5-dev is even necessary
The error message thrown here is misleading - it's not an issue with a sipbuild.api attribute. Indeed, in this case program qmake is missing, see last line of the Python traceback. Have a look if it's installed on your system and add it to your PATH variable. Otherwise, install it. On Linux this would be done with
sudo apt-get install qt5-qmake
I had this problem on my M1 Mac using Python 3.9.12 when I was trying to install a library: pip install pixellib.
The first thing I did was: pip install pixellib --verbose to see the whole log, and there I noticed that PyQt5 was waiting for an input. So then I found someone else with that issue, and used pip install pyqt5 --config-settings --confirm-license= --verbose which took some time to compile, but worked!
I could not get any of the above solutions to work but I managed to get it working using python3.9, PyQt5=5.15.2, pip=22.0.2 and sip=6.5.0 by using sudo apt-get install PyQt5. If you need it in a virtual environment, you can manually copy the PyQt5 folder from your default /usr/lib/python3/dist-packages to the site-packages folder in your virtual environment.
To all those that are struggling with Apple M1 installation, here is a working solution, specifically addressing the problem of installing the pixellib library that depends on PyQt5 but you can apply it equally to other libs:
PyQt5 is not supported on Apple M1, it needs qt6: https://www.reddit.com/r/learnpython/comments/o4w1ut/comment/h2jele3/?utm_source=share&utm_medium=web2x&context=3 , https://www.qt.io/product/qt6
this means you need to install PyQt6: python3 -m pip install PyQt6
go to the lib you need, in my case pixellib: https://pypi.org/project/pixellib/#files and
download the wheel file
get the wheel tool: pip install wheel
unpack the wheel wheel unpack pixellib-0.7.1-py3-none-any.whl
Change its dependency of PyQt5 to PyQt6
edit pixellib-0.7.1/pixellib-0.7.1.dist-info/METADATA
pyQt5 => pyQt6
pack it back wheel pack pixellib-0.7.1
install it: pip install pixellib-0.7.1-py3-none-any.whl
test in python: `
# should work
import pixellib
P.S. thanks to Terra and ChaOS for supporting work on the project underlying this report.
I finally managed to make it works on M1/M2 Macbook Pro.
None of these answers worked for me, so I looked at brew to install pyqt.
The following command will install pyqt5 via brew:
brew install pyqt#5
Then it just worked.
This can be resolved by switching to an environment with Python >= 3.8

How do I solve the issue "No module name Botan"

I am using windows 8 and python 3.6.1 I've done the following command in my cmd:
pip install cryptoshop
However, when I run the following python code:
from cryptoshop import encryptfile
from cryptoshop import decryptfile
result1 = encryptfile(filename="test", passphrase="mypassphrase", algo="srp")
print(result1)
result2 = decryptfile(filename="test.cryptoshop", passphrase="mypassphrase")
print(result2)
I get the following error:
Traceback (most recent call last):
File "C:/Users/Owner/Desktop/test.py", line 1, in
from cryptoshop import encryptfile
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop__init__.py", line 26, in
from cryptoshop.cryptoshop import encryptfile
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop\cryptoshop.py", line 56, in
from ._cascade_engine import encry_decry_cascade
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_cascade_engine.py", line 27, in
from ._nonce_engine import generate_nonce_timestamp
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_nonce_engine.py", line 39, in
import botan
ModuleNotFoundError: No module named 'botan'
Now, I obviously know that you must install botan into python in order to use it. However, this is where I am running into an issue. I've downloaded Botan from this link as instructed:
https://github.com/randombit/botan
And then I've followed these instructions in an attempt to install Botan:
./configure.py [--prefix=/some/directory]
make
make install
However, when I type make into the command line I get an error saying there is no such command. And then when I go to run my above Python code I still get the no module Botan error. So obviously I am doing something run. How can I properly install Botan into my Python 3.6 directories so that I can use cryptoshop.
I've also attempted to do pip install Botan, as that is how I've installed so many other python libraries but that has been unsuccessful as well.
make is a linux command
According to the botan website you can use nmake as a replacement on windows ( http://wiki.c2.com/?UsingNmake ) :
On Windows
You need to have a copy of Python installed, and have both Python and
your chosen compiler in your path. Open a command shell (or the SDK
shell), and run:
$ python configure.py --cc=msvc (or --cc=gcc for MinGW) [--cpu=CPU]
$ nmake
$ botan-test.exe
$ nmake install
Botan supports the nmake replacement Jom which enables you to run
multiple build jobs in parallel.
source : https://botan.randombit.net/manual/building.html
For completeness, here's how I made it work on a Mac
Assuming you have brew installed.
brew install botan
You may need to install other functionality first:
brew install gmp
brew install mpfr
brew install mpc
Find out where botan got installed with brew info botan.
My location is /usr/local/Cellar/botan/2.6.0
In that folder, you'll find lib/python2.7/site-packages, copy the contents of this folder into your Python's installation site-packages folder.
Note 1: At the time of this writing, only python 2.7 seems to be supported, but I'm using python 3.6 and everything seems to be working.
Note 2: If the file is called botan2.py, you may need to rename it to botan.py in your python's site-packages folder.

Easy_install and Pip doesn't work

Easy_install and Pip doesn't work anymore on python 2.7, when I try to do:
sudo easy_install pip
I get:
Traceback (most recent call last):
File "/usr/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 2713, in <module>
parse_requirements(__requires__), Environment()
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.15
And when I try:
sudo pip install [package]
I get:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 2713, in <module>
parse_requirements(__requires__), Environment()
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==0.8.2
I've already install both of them (and yes, first deleted them), but no result...
Thanks!
(I tried already this post)
I had this issue where python's distribute package wasn't installed for some reason. After following the instructions on python-distribute, i got it working.
install the distribute package as follows:
$ wget https://web.archive.org/web/20100225231201/http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
EDIT: http://python-distribute.org/distribute_setup.py no longer works:
hopefully this will resolve your problem with running
$ sudo easy_install
Happy Coding!
If you installed a new version of easy_install through Distribute, the new command may have been installed in another directory, most likely /usr/local/bin/. But the traceback shows you were using /usr/bin/easy_install. Try this:
sudo /usr/local/bin/easy_install ...
Try
sudo easy_install Distribute
and if that exists, but is too old
sudo easy_install -U Distribute
Looks like either Distribute/setuptools (it's old name) is messed up or Python package settings. If either of these do not help, try removing the full Python 2.7 installation and reinstall everything from the scratch.
Possible reasons for the mess is that you have used both sudo easy_install / sudo pip and Linux distribution packages to mix and match system-wide installation packages. You should use virtualenv instead if you use pip/easy_install (no sudo needed)
http://pypi.python.org/pypi/virtualenv
I had a similar problem, but things were working fine as root. In my case, I found that the permissions on the python packages were not readable by the ID I was running the command under.
To correct it, I ran the following command to open the permission for read and execute to all users:
sudo chmod o+rx -R /usr/local/lib/python2.7/dist-packages/*.egg
I had similar issue when trying to install package via pip with python 3.6 on windows. (pip is supposed to work out of the box with this install)
The problem was not running as administrator.
Running cmd as administrator and then installing my package worked:
python -m pip install pylint
I was trying to get pip to work on the 2.7.0 version, but it seems like it doesn't come with the easy_install/pip files (Script folder in main directory), installing 2.7.13 solved the problem for me.

How to install python-dateutil on Windows?

I'm trying to convert some date/times to UTC, which I thought would be dead simple in Python - batteries included, right? Well, it would be simple except that Python (2.6) doesn't include any tzinfo classes. No problem, a quick search turns up python-dateutil which should do exactly what I need.
The problem is that I need to install it on Windows. I was able to upack the .tar.gz2 distribution using 7-zip, but now I'm left with a collection of files and no guidance on how to proceed. When I try to run setup.py I get the error "No module named setuptools".
If dateutil is missing install it via:
pip install python-dateutil
Or on Ubuntu:
sudo apt-get install python-dateutil
Why didn't someone tell me I was being a total noob? All I had to do was copy the dateutil directory to someplace in my Python path, and it was good to go.
Looks like the setup.py uses easy_install (i.e. setuptools). Just install the setuptools package and you will be all set.
To install setuptools in Python 2.6, see the answer to this question.
Install from the "Unofficial Windows Binaries for Python Extension Packages"
http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-dateutil
Pretty much has every package you would need.
It is a little tricky for people who is not used to command prompt. All you have
to do is open the directory where python is installed (C:\Python27 by default) and open the command prompt there (shift + right click and select open command window here) and then type :
python -m pip install python-dateutil
Hope that helps.
Using setup from distutils.core instead of setuptools in setup.py worked for me, too:
#from setuptools import setup
from distutils.core import setup
If you are offline and have untared the package, you can use command prompt.
Navigate to the untared folder and run:
python setup.py install
Just run command prompt as administrator and type this in.
easy_install python-dateutil
You could also change your PYTHONPATH:
$ python -c 'import dateutil'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named dateutil
$
$ PYTHONPATH="/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg":"${PYTHONPATH}"
$ export PYTHONPATH
$ python -c 'import dateutil'
$
Where /usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg is the place dateutil was installed in my box (centos using sudo yum install python-dateutil15)
First confirm that you have in C:/python##/Lib/Site-packages/ a folder dateutil, perhaps you download it, you should already have pip,matplotlib, six##,,confirm you have installed dateutil by--- go to the cmd, cd /python, you should have a folder /Scripts. cd to Scripts, then type --pip install python-dateutil --
----This applies to windows 7 Ultimate 32bit, Python 3.4------
I followed several suggestions in this list without success. Finally got it installed on Windows using this method: I extracted the zip file and placed the folders under my python27 folder. In a DOS window, I navigated to the installed root folder from extracting the zip file (python-dateutil-2.6.0), then issued this command:
.\python setup.py install
Whammo-bammo it all worked.

Categories