79

conda update conda >> successful

conda update anaconda >> gives me error saying package is not installed in prefix.

I have single installation of Python distribution on my system. How do I solve this issue?

(base) C:\Users\asukumari>conda info
 active environment : base
active env location : C:\Users\asukumari\AppData\Local\Continuum\anaconda3
        shell level : 1
   user config file : C:\Users\asukumari\.condarc  populated config files : C:\Users\asukumari\.condarc
      conda version : 4.5.9
conda-build version : 3.4.1
     python version : 3.6.4.final.0
   base environment : C:\Users\asukumari\AppData\Local\Continuum\anaconda3  (writable)
       channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                      https://repo.anaconda.com/pkgs/main/noarch
                      https://repo.anaconda.com/pkgs/free/win-64
                      https://repo.anaconda.com/pkgs/free/noarch
                      https://repo.anaconda.com/pkgs/r/win-64
                      https://repo.anaconda.com/pkgs/r/noarch
                      https://repo.anaconda.com/pkgs/pro/win-64
                      https://repo.anaconda.com/pkgs/pro/noarch
                      https://repo.anaconda.com/pkgs/msys2/win-64
                      https://repo.anaconda.com/pkgs/msys2/noarch
      package cache : C:\Users\asukumari\AppData\Local\Continuum\anaconda3\pkgs
                      C:\Users\asukumari\AppData\Local\conda\conda\pkgs
   envs directories : C:\Users\asukumari\AppData\Local\Continuum\anaconda3\envs
                      C:\Users\asukumari\AppData\Local\conda\conda\envs
                      C:\Users\asukumari\.conda\envs
           platform : win-64
         user-agent : conda/4.5.9 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.16299
      administrator : False
         netrc file : None
       offline mode : False
sophros
  • 14,672
  • 11
  • 46
  • 75
Rene Duchamp
  • 2,429
  • 2
  • 21
  • 29

11 Answers11

81

Usually this error, "PackageNotInstalledError: Package is not installed in prefix." is because your custom environment doesn't have the conda infrastructure. Instead, it is in your base only. To update the base environment:

conda update --name base conda

To see what version you have installed:

conda list --name base conda

example output of list;

# packages in environment at /Users/me/miniconda2:
#
# Name                    Version                   Build  Channel
conda                     4.6.14                   py27_0  
conda-env                 2.6.0                h36134e3_0  
yatu
  • 86,083
  • 12
  • 84
  • 139
AnneTheAgile
  • 9,932
  • 6
  • 52
  • 48
27

to solve the problem after message "PackageNotInstalledError: Package is not installed in prefix" package name: anaconda:

    conda update --all
    ...
    Proceed ([y]/n)? y

regards !

Lionel G
  • 457
  • 6
  • 10
  • 7
    That will update every package in your current env. That seems unlikely to be the goal. – AnneTheAgile Jun 25 '19 at 16:48
  • 3
    Thank you. It worked. I had created and env and I got this error resolved with the command conda update --all. Cheers – emeralddove Aug 17 '19 at 12:57
  • doesn't seem to work. How do I re-install all of conda? – Charlie Parker Dec 09 '21 at 19:27
  • this is my full error: `PackageNotInstalledError: Package is not installed in prefix. prefix: /dfs/scratch0/brando9/miniconda/envs/metalearning_gpu package name: conda ` your answer doesn't help. Do I change base to the name I give above? – Charlie Parker Nov 09 '22 at 01:02
8

I got this error when I tried to update while my conda environment was activated. The solution was to first deactivate:

conda deactivate

before trying to update:

conda update conda

conda update anaconda

5Ke
  • 1,209
  • 11
  • 28
  • 1
    I still received this error after changing the environment back to base since anaconda was not in my default channels. Please see my answer for the solution to that if you still get this error message like I did. – Dan Boschen Oct 28 '22 at 16:23
5

Was having the same problem, nothing worked but:

conda install anaconda

fixed it.

John Doe
  • 596
  • 5
  • 8
4

I was getting the following error when trying to update boto3 in my conda environment:

PackageNotInstalledError: Package is not installed in prefix. prefix: /usr/local/anaconda3/envs/myfoldername

package name: boto3

This was after having already just done: conda install anaconda, conda update -n root conda and conda update --all

However, I did finally succeed in updating boto3, by specifying the version number as follows:

conda install boto3=1.12

3

I met the same problem in my window1 10. pls change the env to base, because the package "conda" only can be updated in base. regards!

XinYang
  • 31
  • 1
  • yup, this is the real solution to the problem. I just did this and it worked, without any extra finagling. – autonopy Nov 11 '21 at 16:42
  • I still received this error after changing the environment back to base since anaconda was not in my default channels. Please see my answer for the solution to that if you still get this error message like I did. – Dan Boschen Oct 28 '22 at 16:22
3

When a package is installed via pip in a conda env, and updated via conda, it results in the same error message shown. In this case, use

pip install package_name --upgrade

This solved my problem.

ewayzhan
  • 41
  • 2
2

This worked for me:

conda update -n base -c defaults conda
daguz_
  • 21
  • 2
1

I received this error since anaconda was not available in my default channels. I fixed this by forcing the channel to be anaconda as follows:

conda install -c anaconda anaconda 
Dan Boschen
  • 265
  • 1
  • 11
0

I don't know why but this removed the issue when I put it in my .bashrc file:

export PATH="$HOME/miniconda/bin:$PATH"
source ~/miniconda/bin/activate
conda activate metalearning_gpu

obvious miniconda was int he right place, change that to ur right path to conda stuff.

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
-6

This works for me:

source active <your python env>
showdev
  • 28,454
  • 37
  • 55
  • 73