Anaconda/osx - change the standard python version

Asked

Viewed 2,056 times

1

I was using python with anaconda in osx 10.8 and Spyder crashed. When I tried to reboot, the launcher showed Spyder as not installed. I imagined that the anaconda might have had some problem and restarted the computer, but the problem continued.

Trying to find the source, I noticed that the standard python version had changed:

$ python --version
Python 3.4.1 :: Continuum Analytics, Inc.

I tried to change it back using defaults write, redoing the link with ln -sf and creating a alias python=python2.7, nothing helped.

So I tried to use the Conda to remove python3, but conda remove python3 does not work. Using the Agreement to fetch installed packages returns this:

$ conda search python
Fetching package metadata: ..
(...)
python                       1.0.1                         0  defaults        
                             (...)
                          .  2.7.5                         2  defaults        
                          .  2.7.5                         3  defaults        
                             (...)
                          *  3.4.1                         0  defaults        

I tried to check the Continuum documentation, but they recommend leaving 2.7 by default and creating Anaconda environments to use different versions, which also doesn’t help me.

Does anyone have any idea how to change the pattern back to version 2.7?

(System specifications: anaconda 1.7.0, osx 10.8.5, Conda 3.5.2)

1 answer

0


Okay, I found a similar problem on the Continuum mailing list.

I solved the problem by reinstalling python using the Conda:

$ conda install python=2.7
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /Users/kadu/anaconda:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-3.5.2                |           py27_0         135 KB
    pycosat-0.6.1              |           py27_0          57 KB
    python-2.7.6               |                2        16.5 MB
    pyyaml-3.11                |           py27_0         149 KB
    requests-2.3.0             |           py27_0         564 KB
    ------------------------------------------------------------
                                           Total:        17.4 MB

The following packages will be UN-linked:

    package                    |            build
    ---------------------------|-----------------
    conda-3.5.2                |           py34_0
    pycosat-0.6.1              |           py34_0
    python-3.4.1               |                0
    pyyaml-3.11                |           py34_0
    requests-2.3.0             |           py34_0

The following packages will be linked:

    package                    |            build
    ---------------------------|-----------------
    conda-3.5.2                |           py27_0   hard-link
    pycosat-0.6.1              |           py27_0   hard-link
    python-2.7.6               |                2   hard-link
    pyyaml-3.11                |           py27_0   hard-link
    requests-2.3.0             |           py27_0   hard-link

Proceed ([y]/n)? 

This method can also be used to choose the standard package in anaconda:

$ conda install python=3.4
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /Users/kadu/anaconda:

The following packages will be UN-linked:

    package                    |            build
    ---------------------------|-----------------
    conda-3.5.2                |           py27_0
    pycosat-0.6.1              |           py27_0
    python-2.7.6               |                2
    pyyaml-3.11                |           py27_0
    requests-2.3.0             |           py27_0

The following packages will be linked:

    package                    |            build
    ---------------------------|-----------------
    conda-3.5.2                |           py34_0   hard-link
    pycosat-0.6.1              |           py34_0   hard-link
    python-3.4.1               |                0   hard-link
    pyyaml-3.11                |           py34_0   hard-link
    requests-2.3.0             |           py34_0   hard-link

Proceed ([y]/n)? 

Note that doing so forces the user to manually reinstall any other package that is used. I needed to reinstall Spyder, which seems to have caused the bug first and presumably was reinstalled when I tried to release it in the wrong version. All other libraries, which I did not try to reinstall, came back to work normally with version 2.7.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.