简体   繁体   中英

Conda not installed PackageNotInstalledError: Package is not installed in prefix

Im a new Anaconda user and my Anaconda navigator fails to start every time. I tried the other answers on the.net like setting PATH, and "conda update --all" on Anaconda Prompt. The following error occurs even after everything was done:

(base) C:\Users\utkar>conda update conda

PackageNotInstalledError: Package is not installed in prefix.
  prefix: C:\Anaconda3
  package name: conda

The error report created by conda is attached:

'''

>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\conda\exceptions.py", line 1003, in __call__
    return func(*args, **kwargs)
  File "C:\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "C:\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 82, in do_call
    exit_code = getattr(module, func_name)(args, parser)
  File "C:\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 20, in execute
    install(args, parser, 'install')
  File "C:\Anaconda3\lib\site-packages\conda\cli\install.py", line 257, in install
    force_reinstall=context.force_reinstall or context.force,
  File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 107, in solve_for_transaction
    force_remove, force_reinstall)
  File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_for_diff
    force_remove)
  File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 241, in solve_final_state
    ssc = self._add_specs(ssc)
  File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 441, in _add_specs
    conda_prefix_rec = ssc.prefix_data.get('conda')
  File "C:\Anaconda3\lib\site-packages\conda\core\prefix_data.py", line 109, in get
    return self._prefix_records[package_name]
KeyError: 'conda'

$ C:\Anaconda3\Scripts\conda-script.py install conda`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=C:\Anaconda3\condabin\..\Scripts\conda.exe
               CONDA_EXES="C:\Anaconda3\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=C:\Anaconda3
    CONDA_PROMPT_MODIFIER=(base)
               CONDA_ROOT=C:\Anaconda3
              CONDA_SHLVL=1
                 HOMEPATH=\Users\utkar
                     PATH=C:\Anaconda3;C:\Anaconda3\Library\mingw-w64\bin;C:\Anaconda3\Library\u
                      sr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Anaconda3\bin;
                          C:\Anaconda3;C:\Anaconda3\Library\mingw-w64\bin;C:\Anaconda3\Library\u
                      sr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Anaconda3\bin;

C:\Anaconda3\condabin;C:\ProgramData\Oracle\Java\javapath;C:\Program
                      Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Wi
                      ndows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
                      \WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R)
                      Management Engine Components\DAL;C:\Program Files\Intel\Intel(R)
                      Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R)
                      Management Engine Components\IPT;C:\Program Files\Intel\Intel(R)
                      Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corpora
                      tion\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\W
                      bem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program
                      Files\Git\cmd;C:\php;C:\Program
                      Files\nodejs;C:\Apache24\bin;C:\Program Files\MySQL\MySQL Utilities 1.
                      6;C:\WINDOWS\System32\OpenSSH;C:\Anaconda3;C:\Anaconda3\Scripits;\Anac
                      onda3\Scripts;C:\Anaconda3
         PSMODULEPATH=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\W
                      indowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Mo
                      dules
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : C:\Anaconda3
            shell level : 1
       user config file : C:\Users\utkar\.condarc
 populated config files : C:\Users\utkar\.condarc
          conda version : 4.6.14
    conda-build version : 3.17.8
         python version : 3.7.3.final.0
       base environment : C:\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/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Anaconda3\pkgs
                          C:\Users\utkar\.conda\pkgs
                          C:\Users\utkar\AppData\Local\conda\conda\pkgs
       envs directories : C:\Anaconda3\envs
                          C:\Users\utkar\.conda\envs
                          C:\Users\utkar\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.6.14 requests/2.22.0 CPython/3.7.3 Windows/10 Windows/10.0.17134
          administrator : False
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

'''

Help solve this error please.

I am wondering if this is not a manifestation of this bug .

If so, the following should help:

conda update -n base conda (if you have conda >=4.4)

Or for older versions of conda:

conda update -n root conda

Got similar error with conda 4.13 on Linux, trying to install a python package ("google-cloud-sdk"):

Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source.

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/mnt/miniconda/lib/python3.9/site-packages/conda/exceptions.py", line 1114, in __call__

        ...

      File "/mnt/miniconda/lib/python3.9/site-packages/conda/core/prefix_data.py", line 131, in get
        return self._prefix_records[package_name]
    KeyError: 'python'

Apparently it was caused since conda was already activated in the current environment, when I was trying to install the package. Deactivating conda, and reinstalling the package has resolved it:

conda deactivate
conda install -y --update-deps -c conda-forge "google-cloud-sdk"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM