Why is Python easy_install not working on my Mac?
Asked Answered
M

7

60

I have a Mac running Python 2.6. When I try to use easy_install I get this message:

/usr/bin/easy_install-2.6:7: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  from pkg_resources import load_entry_point
/usr/bin/easy_install-2.6:7: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  from pkg_resources import load_entry_point
Traceback (most recent call last):
  File "/usr/bin/easy_install-2.6", line 10, in <module>
    load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
    return False
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
    deps = []
ImportError: Entry point ('console_scripts', 'easy_install') not found

I am very confused by this and I want to know how I can fix this. Previously I didn't get this message, then after installing pip and uninstalling it, easy_install no longer works. I was wondering how I could fix this, or restore the default Python or easy_install setting on Mac.

Machinery answered 16/5, 2011 at 0:32 Comment(0)
C
155
  1. Check your /usr/bin and /usr/local/bin for easy_install installations and remove any old script:

    sudo rm -f /usr/bin/easy_install*
    sudo rm -f /usr/local/bin/easy_install*
    
  2. Download and run distribute:

    curl -O https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py
    
    sudo python distribute_setup.py
    sudo rm distribute_setup.py
    
  3. Try again, and enjoy. E.g.:

    sudo easy_install pip
    
Chism answered 24/9, 2012 at 23:42 Comment(7)
These instructions worked perfectly after the Mountain Lion upgrade borked everything. This got easy_install and pip working, which let me upgrade my virtualenv and virtualenvwrapper, and everything's happy again.Dragonhead
This also worked for me after installing OSX 10.9 Mavericks. ThanksSchear
I'm gettin "-bash: /usr/bin/easy_install: No such file or directory", I may have forgotten the asterisk at the end, any ideas on how to fix my predicament?Surround
No worries about that. It means it could not find it there, but there is a possibility you have them on /usr/local/bin... In any case, execute all the commands all over again.Chism
Use URL https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py since python-distribute.org isn't up.Selfexcited
@Selfexcited Any idea why or how long is that going to be for?Chism
I don't think anything is installed into my /usr/bin/ or /usr/local/bin/ after running sudo python distribute_setup.py because I get -bash: /usr/bin/easy_install: No such file or directory error message.Jimmyjimsonweed
J
27

I suspect the easiest way you can get easy_install working again is to install distribute, which is an improved version of distutils that bundles it's own version of easy_install. Installation is simple:

curl -O http://python-distribute.org/distribute_setup.py
/usr/bin/python2.6 distribute_setup.py
Joslyn answered 16/5, 2011 at 1:0 Comment(4)
If you're using Homebrew you can do sudo brew install distributeRoyster
It appears that distribute now comes with the python recipe, but scripts are put into /usr/local/share/python/ so you may be picking up an old version of easy_install symlinked in /usr/local/bin. See: github.com/mxcl/homebrew/wiki/Homebrew-and-PythonFokker
Thanks a lot, this fixed my Python install problem! pip, easy_install and friends all gave errors after upgrading pip+virtualenv.Acaulescent
Sounds like the installation of easy_install is not easy at all. (shrug)Tanhya
P
9

I had the same problem just after installing the new Operating System (Lion OSX). After install python and execute it

sudo easy_install ipython
ipython

I got the following error:

Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 8, in <module>
    load_entry_point('ipython==0.10.2', 'console_scripts', 'ipython')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 318, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2220, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'ipython') not found

Then I realize it was a permission problem. If I execute the ipython script as sudo it worked.

sudo ipython

So I changed the ownership from root to my user () of the folder /Library/Python/2.7/site-packages/

sudo chown -R <your_user>:wheel /Library/Python/2.7/site-packages/

Use change ownership only if you don't have several accounts that uses python.

I hope it work for you.

Best

Piles answered 23/7, 2011 at 22:7 Comment(1)
It's probably a better idea to chmod than to chown in this case.Caz
Z
5

Your setuptools installation is broken. The easy_install-2.6 script in your /usr/bin directory, is only a wrapper that loads the actual easy_install module in your Python installation, and the latter is missing. Presumably uninstalling pip either broke the pointer to it (usually in the form of a .pth file in your site-packages directory) or removed the whole package but didn't remove the /usr/bin/easy_install-2.6 wrapper script.

Your best bet is to re-install setuptools from scratch again, by following the instructions on the setuptools PyPI page.

Zlatoust answered 4/6, 2011 at 16:55 Comment(0)
D
3

I had the same problem, I suspect caused by my installation of Homebrew which apparently installs its own version of easy_install blindly and screws up whatever you're currently running (enough times for homebrew to recognize it as a problem). I found my solution here Upgraded Python on Snowleopard Using Homebrew now pip and easy_install don't work

While I'm actually on Lion, it still fixed my problem. You just download ez_setup.py from http://pypi.python.org/pypi/ez_setup - run ez_setup.py through terminal and you're off to the races.

Darcee answered 22/3, 2012 at 17:5 Comment(0)
S
1

I had a similar error message after following similar steps. I suspect it's because I tried to install the distribute module, and it tried to install a new version of setuptools which didn't quite work because it failed to correctly override the Mac OS X supplied setuptools. But that's only a suspicion.

I fixed my problem by doing the following. I found that the directory /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python had 4 files with .OLD in the name. When I did a compare with similarly named files without the .OLD from when things worked (via Time Machine) I found that they were the same except for the name. So I did the following renames:

setuptools.OLD.1305936263.57 -> setuptools
setuptools-0.6c9-py2.6.egg-info.OLD.1305936263.57 -> setuptools-0.6c9-py2.6.egg-info
pkg_resources.py.OLD.1305936263.57 -> pkg_resources
site.py.OLD.1305936263.59 -> site.py

I had to use the command line and sudo mv because the files are owned by root. For example: sudo mv setuptools.OLD.1305936263.57 setuptools. You'll have to enter your password.

The other thing I did was clean the /Library/Python/2.6/site-packages directory. I used Time Machine to set it back to its pre-messed up state. If you don't have Time Machine, then you should be able to recover if you delete any files or folders beginning with distribute, easy-install, pip, pkg_resources, setuptools and site.

If that doesn't do the trick, uninstall any modules you can from that directory. For example use pip uninstall if you installed modules with pip. The reason to do this is that installation can copy files into usr/local/bin and other places that pip will remove for you.

Next it's time to remove any remaining modules. Rename the folder (in case there's something you want later) and make a new empty one.

Reinstall the modules you want and with a little luck you're back in business...

Sungkiang answered 2/7, 2011 at 19:29 Comment(0)
H
0

Martijn Pieter's answer is correct.

  1. Go to http://pypi.python.org/pypi/setuptools#downloads
  2. Download setuptools-0.6c11-py2.7.egg
  3. From your downloads directory run: sudo ./setuptools-0.6c11-py2.7.egg

Done :-)

Hissing answered 28/7, 2011 at 14:3 Comment(1)
I have a very similar problem but I had to downgrade setuptools to exactly 0.6c9 that it was asking for. Now I have a gcc error.Geothermal

© 2022 - 2024 — McMap. All rights reserved.