Help getting iPython to run from the OSX terminal

7,777

Looks like your Python 2.6 installation is through MacPorts, based on the /opt/local prefix. If you didn't install it with MacPorts and have your own reason for using /opt/local, ignore this answer. If you did, you can install ipython with port.

port install py26-ipython

Make sure that your $PATH environment variable is set to include /opt/local/bin. This should have been done by the MacPorts installer. My ~/.profile looks like:

# MacPorts Installer addition on 2009-03-05_at_21:11:52: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.


# MacPorts Installer addition on 2009-03-05_at_21:11:52: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.

I would be careful using easy_install in conjunction with MacPorts python, especially for modules that MacPorts already provides. For example, MacPorts ipython puts the executable at /opt/local/bin/ipython2.6 along with /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipython

EDIT
To uninstall the easy_installed version of ipython, from what I know you'll need to manually delete the associated files. I'm taking a leap here based on my installation of ipython. First delete the executables:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipcluster
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipcontroller
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipengine
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/iptest
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipython
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipython-wx
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ipythonx
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/irunner
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/pycolor

Then, delete the folder and egg-info in site-packages:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ipython-0.10-py2.6.egg-info

Then, delete the doc folder:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/doc/ipython/

Then, delete the man files:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipcluster.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipcontroller.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipengine.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipython-wx.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipython.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/ipythonx.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/irunner.1.gz
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/man/man1/pycolor.1.gz

Finally, open the file /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/easy-install.pth and see if there is a line referring to the ipython egg. Delete that.

Share:
7,777

Related videos on Youtube

PizzAzzra
Author by

PizzAzzra

Updated on September 17, 2022

Comments

  • PizzAzzra
    PizzAzzra over 1 year

    Got a heads up from stackoverflow.com to ask the question here.

    I'm going through the matplotlib documentation and prepared to use the iPython interactive Python shell with ipython -pylab. However I get this:

    MBP:~ Me$ ipython -pylab
    -bash: ipython: command not found
    

    Did I fail to install iPython? I used easy_install as advised.

    Any ideas?

    Update

    Thought I'd just say that I found the iPython "executable" in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin after doing a Spotlight search.

    Still a little confused as to what to do.

  • PizzAzzra
    PizzAzzra almost 14 years
    Oh bugger, I think I may have done something noobish and indeed installed iPython using easy_install. A friend installed Python 2.6.4 installed using MacPorts around November. I think he set it up such that I can run Python off the terminal without digging deep into the /opt/local/bin - would that make sense that I can just type and run python in the Terminal because of that? Yes, I'm still very green at this Unix/Linux/MacOSX thing...
  • PizzAzzra
    PizzAzzra almost 14 years
    PS - How can I uninstall the easy_install version of iPython?
  • PizzAzzra
    PizzAzzra almost 14 years
    Many thanks :) That sorted out the stupid easy_install business. Then I tried to run port -v selfupdate followed by sudo port install py26-ipython and then I was flabbergasted as it tried to install gettext and sqlite3 and then proceeded to upgrade my Python from 2.6.4 to 2.6.5...