Install a newer version of anaconda while keeping the existing one

Post date: Aug 4, 2014 5:53:51 PM

I have anaconda for python 2.7 installed on my machine already, however I want a newer version of it that supports python 3.4 while keeping the existing version of anaconda. I went to download the graphic install .dmg file from the continuum website, and tried to install it in the same directory as the existing anaconda (~/). This results in Installation Failed!!!! I think that's because the new version also creates the python directory ~/anaconda, which is identical to the existing directory, and that would make the installation fail.

My solution is to create another directory ~/anaconda3/ and install the newer version in the directory. This works fine for me. You can test by trying the command below:

$ ~/anaconda3/anaconda/bin/python
Python 3.4.1 |Anaconda 2.0.1 (x86_64)| (default, May 19 2014, 13:05:46) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

you can also check that the existing version still work:

$ ~/anaconda/bin/python
Python 2.7.6 |Anaconda 1.9.2 (x86_64)| (default, Jan 10 2014, 11:23:15) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

At this point you will notice that the new anaconda has not been added to PATH yet:

$ echo $PATH
/Users/kittipat/anaconda/bin:/Users/kittipat/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin

we can just add the new version path to PATH:

$ export PATH=~/anaconda3/anaconda/bin:$PATH
$ echo $PATH
/Users/kittipat/anaconda3/anaconda/bin:/Users/kittipat/anaconda/bin:/Users/kittipat/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin

You will even find that the new version becomes default python:

$ which python
/Users/kittipat/anaconda3/anaconda/bin/python
$ which ipython
/Users/kittipat/anaconda3/anaconda/bin/ipython