4

After an update of OS X Yosemite 10.10.5 my Python install has blown up. I am not using brew, macports, conda or EPD, here, but a native Python build. While it was perfectly functional before, now it seems to have lost track of the installed packages. I try to start an ipython session and it returns

$ ipython
Traceback (most recent call last):
   File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython", line 7, in <module>
from IPython import start_ipython
ImportError: No module named IPython

Then I resort to checking whether I can re-install ipython but my pip also went missing:

$ sudo pip install ipython
Traceback (most recent call last):
   File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip

So may it be that pip disappeared?

$ sudo easy_install install pip
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

I have tried solutions to this last problem reported before but they do not seem to work.

So it seems that Python has lost track of itself. Anyone, clues of what may have gone wrong and how can I fix this? Thanks!

Community
  • 1
  • 1
ricoamor
  • 297
  • 1
  • 6
  • 18

1 Answers1

3

It is not quite clear what you mean by saying that you installed "a native Python build". But in any case, it seems you wrote files of your installation into the system directory" /System/..., which is not a good thing to do, since these are controlled by OSX and e.g. may be overwritten by a system update.

Apparently, that is then what happened. You updated OSX, it clobbered your changes to /System/... and thereby messed up your Python installation.

Note that AFAIK, with OSX 10.11 it will no longer even be possible to write into system directories, so you will need a different setup anyway.

A suggestion to avoid/fix this is simple: Use one of the standard ways to install your Python stack -- my personal recommendation is either macports or anaconda.

m7thon
  • 2,883
  • 1
  • 7
  • 15
  • With "native" I meant the version already present in my OS. I remember following some advice from [this](https://wolfpaulus.com/journal/mac/installing_python_osx/) website. – ricoamor Aug 31 '15 at 12:00
  • And while this of couse works it feels more like a workaround than a solution, right? – ricoamor Aug 31 '15 at 12:01
  • This is not a workaround. That website gave you bad advice; you should not be modifying the contents of `/System`. – chepner Aug 31 '15 at 13:11