After updating conda I get a CommandNotFoundError

2020-02-11 03:39发布

问题:

After updating conda I can no longer run commands such as conda list, I now see the following error when I try a conda command:

CommandNotFoundError: No command 'conda conda'

The conda update was performed like so:

$ conda update -n base -c defaults conda
Collecting package metadata: ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: C:\home\miniconda

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.6.9                |           py37_0         1.7 MB
    ------------------------------------------------------------
                                           Total:         1.7 MB

The following NEW packages will be INSTALLED:

  pip                pkgs/main/win-64::pip-19.0.3-py37_0

The following packages will be UPDATED:

  conda                                        4.6.8-py37_0 --> 4.6.9-py37_0


Proceed ([y]/n)?


Downloading and Extracting Packages
conda-4.6.9          | 1.7 MB    | ########## | 100%
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done

My .bashrc file has the following line in it, and it also results in the above error upon creation of a new git/bash console on Windows 10:

eval "$('/c/home/miniconda/Scripts/conda.exe' 'shell.bash' 'hook')"

Is the above part of the problem?

My PATH environment variable contains conda-related paths at the front:

$ echo $PATH
/c/home/miniconda/condabin:/c/home/miniconda/Scripts:...

$ which conda
/c/home/miniconda/Scripts/conda

$ ll /c/home/miniconda/condabin
total 16
-rw-r--r-- 2 James Adams 197121 1995 Mar 29 21:46 _conda_activate.bat
-rw-r--r-- 2 James Adams 197121  147 Mar 29 21:46 activate.bat
-rw-r--r-- 2 James Adams 197121 1063 Mar 29 21:46 conda.bat
-rw-r--r-- 2 James Adams 197121  530 Mar 29 21:46 conda_auto_activate.bat
-rw-r--r-- 2 James Adams 197121  649 Mar 29 21:46 conda_hook.bat
-rw-r--r-- 2 James Adams 197121  192 Mar 29 21:46 deactivate.bat
-rw-r--r-- 2 James Adams 197121   65 Mar 29 21:46 rename_tmp.bat

Can anyone suggest how to fix this issue?

回答1:

This cropped up for me today too. It appears to be a bug in conda 4.6.9.
I deleted everything conda-related but C:\Users\[username]\Anaconda3 and C:\Users\[username]\Anaconda3\Scripts from my PATH and conda commands started working. I still couldn't run source activate [environment] in bash without getting:

CommandNotFoundError: No command 'conda conda'

So I downgraded to 4.6.8 with:

conda install conda=4.6.8

And it solved my problem.



回答2:

I too have been getting this error. Just like Gregory Allan stated, downgrading conda to 4.6.8 fixed it for me, and everything would work as intended.

Another way of downgrading without running a command in the terminal is to use Anaconda Navigator, and then you can select the packages you want to update or downgrade.