Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inconsistent Anaconda root env after failed Python 3.5 update

I recently tried to update the root environment of my Anaconda install from Python 3.4 to Python 3.5 by using the command

conda install python=3.5

After doing that, I ran

conda update --all python=3.5

hoping it would update all other packages to Python 3.5 versions, but it fails with the error message below: (note that I omitted many packages in the middle of this list)

The following specifications were found to be in conflict:
  - backports_abc -> python 2.7*|3.4*
  - certifi -> python 2.7*|3.4*
  - colorama -> python 2.7*|3.4*|3.5*
  - conda -> python 2.7*|3.4*|3.5*
  - conda-env -> python 2.7*|3.4*
  - decorator -> python 2.7*|3.4*
  - django -> python 2.7*|3.4*
  - ecdsa -> python 2.7*|3.4*
  - flask -> python 2.7*|3.4*
  - greenlet -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - ipykernel -> python 2.7*|3.4*

[...many more...] 

  - simplegeneric -> python 2.7*|3.4*|3.5*
  - six -> python 2.7*|3.4*
  - werkzeug -> python 2.7*|3.4*
  - wheel -> python 2.7*|3.4*
Use "conda info <package>" to see the dependencies for each package.

It seems that I've now screwed up my root environment. I'd like to just uninstall all the packages in it, but the command

conda uninstall --all

just complains:

Error: cannot remove current environment. deactivate and run conda remove again

(of course I cannot deactivate my environment since I'm in the root environment already.)

So, is there any way to easily clean up the root environment? Or, is there a way to correctly update all packages for Python 3.5?

Edit (5/10/2016)

I forgot to mention originally that the system I'm running on is Mac OS X 10.11 (El Capitan).

like image 300
jb326 Avatar asked Mar 20 '16 18:03

jb326


2 Answers

Just follow these steps to make a clean installation:

First, remove your local anaconda: sudo rm -rf anaconda

Then, install it again from here

like image 83
Perry Avatar answered Sep 27 '22 20:09

Perry


After reading this thread, I found this useful info:

Conda 4.0 is a lot more careful about ensuring that environments have consistent dependencies. Previous versions of conda could actually leave environments in broken states if there were lots of one-off installs and updates.

A side effect is that we're likely to see an uptick in support requests like yours, where conda is doing some surprising things as it gradually corrects broken environments.

Hence, I decided to do a clean installation that eventually solved my issues:

  1. Remove conda and anaconda

    1.1 Deactivate any active environment

    conda info --envs

    source deactivate

    1.2 Manually remove the folders with the packages and code

    sudo rm -rf anaconda/

    sudo rm -rf conda/

  2. Install conda and Anaconda (MiniConda)

    3.1 Download the installer and install it following the instructions.

    3.2 Ensure correct environment variables (optional). Add this line export PATH=$HOME/anaconda/bin:$PATH in .bash_profile. Then run source .bash_profile so that the changes take effect. Check with which python and which pip that your python is administrated by anaconda.

  3. Install your packages

    4.1 Using either conda or pip should work source

    4.2 Update and clean up:

    conda update --all python=3.5

    conda clean --all

    4.2 Check that everything is right:

    conda info

    conda list

like image 28
tashuhka Avatar answered Sep 27 '22 19:09

tashuhka