Is the path broken for anaconda ipython?

I want to use the anaconda distribution for ipython, but typing ipython on the terminal gives an error message:

 Traceback (most recent call last): File "/usr/local/bin/ipython", line 5, in <module> from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module> working_set.require(__requires__) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require needed = self.resolve(parse_requirements(requirements)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: ipython==0.13.1 

Adding PATH to .bash_profile as shown below gives the same error message. By asking which python produces //anaconda/bin/python , and which ipython produces /usr/local/bin/ipython . How can I fix this so that ipython starts anaconda ipython?

 # MacPorts Installer addition on 2012-11-03_at_23:50:01: 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. # Add colors to terminal export CLICOLOR=1 export LSCOLORS=ExFxBxDxCxegedabagacad # added by Anaconda 1.6.1 installer export PATH="//anaconda/bin:$PATH" export PATH=/anaconda//bin/isympy:$PATH # added to Homebrew: bad command export PATH=/usr/local/bin:$PATH 

Update: I updated anaconda and ipython using conda update as suggested, but still getting the same error message.

Update 2: Thanks for all the suggestions. I changed /usr/local/bin/ipython as follows:

 #!//anaconda/bin/python # EASY-INSTALL-ENTRY-SCRIPT: 'ipython==1.1.0','console_scripts','ipython' __requires__ = 'ipython==1.1.0' import sys from pkg_resources import load_entry_point sys.exit( load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')() ) 

Now which ipython creates // anaconda / bin / ipython and starts ipython .

+6
source share
4 answers

One possible reason is that there are several versions of ipython , for example, brew can install on /usr/local/bin , conda can install on /anaconda/bin (this is just a guess). Tip A similar question is to completely remove all ipython installations and install the one you will be using.

+1
source

Your problem is your $ PATH. If you look at your trace, it will run / usr / local / bin / ipython - this is the one installed by Homebrew, not Anaconda. (Anaconda installs everything in / anaconda / bin.)

The reason this happens is because the very last line of your .bash_profile stores / usr / local / bin at the beginning of your path. This means that the ipython you installed through Homebrew masks the one installed by Anaconda.

You have two options:

  • Uninstall the ipython that Homebrew has installed and just use Anaconda for your Python packages.

  • In your .bash_profile, move the Homebrew PATH modification line above Anaconda. This way Anaconda ipython, python and various other Python commands will take precedence.

Remember that if you change your .bash_profile, you need to close your terminal and start a new one for the changes to take effect.

+9
source

It looks like your path is completely fine. Note that the error comes from "/ usr / local / bin / ipython". This is not a bash error, most likely it is an error using setup_tools or pip, which are Python packaging tools. bash finds ipython and runs the ipython startup file, but it encounters an error there.

The error seems to indicate that your version of ipython is incompatible. Have you tried to do something like this?

  conda update conda conda update ipython 

Conda and ipython updates are recommended in the iPython documentation . Perhaps this will fix the problem. If not, add information that you updated conda and ipython to your question.

+3
source

Make sure you check the path to the Python executable specified at the beginning of the script. When I installed iPython, it was defined as:

 #!/usr/bin/python 

Instead:

 #!/usr/local/bin/python 

Therefore, instead of the installed version of brew, the standard OS X installation of Python was installed.

0
source

All Articles