Search code examples
pythonosx-elcapitan

Something screwy with pip/python packages after hard-drive crash


He everyone,

I recently had a harddrive corruption. Luckily I had all my files backed up by the online service CrashPlan.

This program only grabs files from the /users/username director, so when I restored my computer after reformatting my harddrive, I just made sure that the user file that was restored was the admin user on the computer and viola, everything was (almost) back to normal.

I was unable to start up my ipython, so I tried a pip-install. Turns out my pip was also gone (weird), so I redownloaded pip. Then when trying to install ipython I ran into a roadblock, which was solved by this post

However, when I try to start up ipython or ipython notebook from the command line, I get this error:

biot21-159-dhcp:Downloads kevin$ ipython
-bash: ipython: command not found

I tried booting up a new terminal session--no luck. Any ideas?

BTW, I'm running a late 2011 macbook pro with OSX 10.11 (ElCapitan)


EDIT: so doing a reinstall of python using homebrew brew install python and then using pip install ipython did the job. Interestingly, I no longer have to add --user python after the pip statement. I don't know enough to answer why that is, but maybe someone out there that knows more could?


Solution

  • I don't think those binaries are stored in your /users/<username> directory, unfortunately. So you'll need to re-install those from scratch.

    I would recommend you install those applications using homebrew and that includes installing Python through brew as well, rather than tacking stuff onto the OS-bundled Python.

    brew install python
    

    Python will then install into e.g. /usr/local/Cellar/python/2.7.10_2/bin/python

    Then use pip which you'll get bundled with the brew-installed Python, and which you can use to pip install ipython. Just make sure you're executing /usr/local/Cellar/python/2.7.10_2/bin/pip in this case:

    /usr/local/Cellar/python/2.7.10_2/bin/pip install ipython
    

    However, depending on your use case, you might want to consider installing ipython into a virtualenv.

    Edit: As mentioned in my comment to your question, you can read more here about why you should probably leave the OS-bundled Python alone in OS X.