I wish to use anaconda distribution of ipython, but typing ipython
at the terminal produces 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 below produces the same error message. Asking which python
produces //anaconda/bin/python
, and which ipython
produces /usr/local/bin/ipython
. How can I fix this such that ipython
launches 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 get the same error message.
Update 2: Thanks for all the suggestions. I modified /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
produces //anaconda/bin/ipython, and ipython
launches.
Should I add Anaconda to the Windows PATH? When installing Anaconda, Anaconda recommends that you do not add Anaconda to the Windows PATH because this can interfere with other software. Instead, open Anaconda with the Start Menu and select Anaconda Prompt, or use Anaconda Navigator (Start Menu - Anaconda Navigator).
IPython is included by default in Anaconda distribution of Python. It can be downloaded from Anaconda's download page www.anaconda.com/download/ Binaries for all major OS (Windows, MacOS and Linux) and architecture (32 bit and 64 bit) are available on this link.
Your problem is in your $PATH. If you look at your traceback, it's running /usr/local/bin/ipython - this is the one that is installed by Homebrew, and not by Anaconda. (Anaconda installs everything into /anaconda/bin.)
The reason this is getting picked up is because the very last line of your .bash_profile sticks /usr/local/bin at the front of your path. This means that the ipython that you installed via Homebrew is masking the one that's installed by Anaconda.
You have two options:
Uninstall the ipython that Homebrew installed, and just use Anaconda for your Python packages.
In your .bash_profile, move the Homebrew PATH modification line above the Anaconda one. This way, Anaconda's ipython, python, and various other Python commands will take precedence.
Remember, if you change your .bash_profile, you need to close your Terminal and start a new one for the changes to take effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With