pip: error: invalid command ‘egg_info’

If your trying to install packages using pip and getting errors that complain about ‘egg_info’, it is likely because distribute was merged into setuptools as of version 0.7  so you need to upgrade.  

Here is what I was getting when trying to install gensim:

nettles:Project bfeeny$ pip install gensim
Downloading/unpacking gensim
Downloading gensim-0.8.8.tar.gz (2.8MB): 2.8MB downloaded
Running setup.py egg_info for package gensim
/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'extras_require'
warnings.warn(msg)
/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_data'
warnings.warn(msg)
/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_suite'
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:
/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'extras_require'

warnings.warn(msg)

/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_data'

warnings.warn(msg)

/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'

warnings.warn(msg)

/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'

warnings.warn(msg)

/Users/bfeeny/anaconda/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_suite'

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'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/0j/2kbjg_ys7m35z57lw83rdh0w0000gn/T/pip_build_bfeeny/gensim
Storing complete log in /Users/bfeeny/.pip/pip.log

 

Here is how you can fix it by upgrading or installing setuptools:

nettles:Project bfeeny$ pip install --upgrade setuptools
Downloading/unpacking setuptools from https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.tar.gz#md5=5710464bc5a61d75f5087f15ce63cfe0
Downloading setuptools-1.4.tar.gz (793kB): 793kB downloaded
Running setup.py egg_info for package setuptools

Installing collected packages: setuptools
Found existing installation: setuptools 0.6c11
Uninstalling setuptools:
Successfully uninstalled setuptools
Running setup.py install for setuptools

Installing easy_install script to /Users/bfeeny/anaconda/bin
Installing easy_install-2.7 script to /Users/bfeeny/anaconda/bin
Successfully installed setuptools
Cleaning up...

Now we can cleanly install gensim:

nettles:Project bfeeny$ pip install gensim
Downloading/unpacking gensim
Downloading gensim-0.8.8.tar.gz (2.8MB): 2.8MB downloaded
Running setup.py egg_info for package gensim

warning: no files found matching '*.sh' under directory '.'
no previously-included directories found matching 'docs/src*'
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.7.0 in /Users/bfeeny/anaconda/lib/python2.7/site-packages (from gensim)
Installing collected packages: gensim
Running setup.py install for gensim

warning: no files found matching '*.sh' under directory '.'
no previously-included directories found matching 'docs/src*'
Successfully installed gensim
Cleaning up...

This entry was posted in Data Analytics and tagged , , , . Bookmark the permalink.

Leave a Reply