I find that recently often when I try to install a Python package using pip, I get the error(s) below.
I found a reference online that one has to use "python2 setup.py install" from the download directory, and indeed find that this will then work if I manually find and download the package (from pypi).
But, I don't know where pip is downloading packages to, and/or why it is failing in this manner.
I tried to do a pip upgrade, but it also failed in a similar manner, with a bunch of "Unknown distribution option" errors (entry_points, zip_safe, test_suite, tests_require)!
- pip 1.0.1
- ActivePython 2.7
Trying to use ActiveState's pypm fails, because they have a smaller library base, and it doesn't include these packages.
C:\test>pip install requests-oauth
Downloading/unpacking requests-oauth
Downloading requests-oauth-0.4.1.tar.gz
Running setup.py egg_info for package requests-oauth
E:\Plang\ActivePython\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
E:\Plang\ActivePython\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
Complete output from command python setup.py egg_info:
E:\Plang\ActivePython\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
E:\Plang\ActivePython\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
I was facing the same issue and I tried all the above answers. But unfortunately, none of the above worked.
As a note, I finally solve this by
pip uninstall distribute
.I just convert liquidki's answer into Ubuntu commands. On an Ubuntu based system it works!:
I also meet a similar error message "Command 'python setup.py egg_info' failed with error code 1" when I want to install cairosvg with command
pip install cairosvg
in a virtual environment.Then I have tried both
pip install --upgrade pip
andpip install --upgrade setuptools
before runningpip3 install cairosvg
, but I still get this error.I can get rid of this error with sudo in front of the installation command :
sudo pip install cairosvg
. But note that the command with sudo will install the package for the system python rather than the virtual environment.So, I further check the error message and find that I get the error while installing the cairocffi. Then I install a certain version of cairocffi (refer to this answer) before install cairosvg. That is how I solve my problem.
Bear in mind you may have to do
pip install --upgrade Distribute
if you have it installed already and yourpip
may be calledpip2
for Python2 on some systems (it is on mine).