Python Conda 安装和更新不起作用也解决环境获取错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/57518050/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:40:14  来源:igfitidea点击:

Conda install and update do not work also solving environment get errors

pythonanacondaconda

提问by J.D

I am using anaconda as below:

我使用 anaconda 如下:

(base) C:\Users\xxx>conda info

     active environment : base
    active env location : C:\Users\xxx\Documents\ANACONDA
            shell level : 1
       user config file : C:\Users\xxx\.condarc
 populated config files : C:\Users\xxx\.condarc
          conda version : 4.7.11
    conda-build version : 3.18.9
         python version : 3.6.9.final.0
       virtual packages :
       base environment : C:\Users\xxx\Documents\ANACONDA  (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:\Users\xxx\Documents\ANACONDA\pkgs
                          C:\Users\xxx\.conda\pkgs
                          C:\Users\xxx\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\xxx\Documents\ANACONDA\envs
                          C:\Users\xxx\.conda\envs
                          C:\Users\xxx\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.7.11 requests/2.22.0 CPython/3.6.9 Windows/10 Windows/10.0.16299
          administrator : False
             netrc file : None
           offline mode : False

Now I have 2 issues that stop my work. 1) I cannot use conda installfor any package. It will give me the error in solving environmentlist this:

现在我有两个问题阻止了我的工作。1) 我不能conda install用于任何包裹。它会给我solving environment列表中的错误:

failed with initial frozen solve. Retrying with flexible solve.

then it will fail again and give message like this:

然后它将再次失败并给出如下消息:

Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.

Even after the checking for incompatible packages, it didn't give me the solution.

即使在检查了不兼容的包之后,它也没有给我解决方案。

2) When I want to upgrade or downgrade conda by the command:

2) 当我想通过命令升级或降级 conda 时:

conda update -n base conda

or

或者

conda install conda = 4.6.11

It will give me errors again in the solving environment, and I think this is related to the first issue.

它会在 中再次给我错误solving environment,我认为这与第一个问题有关。

Now I cannot use conda for anything, please advise and thank you!

现在我不能使用 conda 做任何事情,请指教,谢谢!

采纳答案by SKiD

I ran into the same problem and I couldn't find a solution, but I did find a workaround. If you create an env and activate that env and then do the install, it seems to work just fine. If you don't need a lot of libraries I would try that.

我遇到了同样的问题,但找不到解决方案,但我确实找到了解决方法。如果您创建一个 env 并激活该 env 然后进行安装,它似乎工作得很好。如果您不需要很多图书馆,我会尝试这样做。

Commands are:

命令是:

  1. Create env
  1. 创建环境
conda create --name myenv
  1. Activate the env
  1. 激活环境
conda activate myenv

回答by Abhyudai

You may downgrade to an older version of conda 4.6.14 and then install your packages.

您可以降级到 conda 4.6.14 的旧版本,然后安装您的软件包。

conda config --set allow_conda_downgrades true
conda install conda=4.6.14

回答by Rochan

Create a new environment if your are not superuser, after that activate environment to install packages

如果您不是超级用户,请创建一个新环境,然后激活环境以安装软件包

回答by Guru

If your conda version is greater than or equal to 4.8, you may see that error.

如果您的 conda 版本大于或等于 4.8,您可能会看到该错误。

(base) [localhost ~]$ conda --version
conda 4.8.2
(base) [localhost ~]$ conda install -c anaconda requests-kerberos
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.

Downgrade your conda if possible using the following commands

如果可能,请使用以下命令降级您的 conda

conda config --set allow_conda_downgrades true
conda install conda=4.6.14

Then create your virtual environment:

然后创建您的虚拟环境:

conda create --name myenv_conda

Then activate your myenv_conda

然后激活你的 myenv_conda

conda activate myenv_conda

Now try to install packages using conda -c install anaconda

现在尝试使用 conda -c install anaconda 安装软件包

eg: conda install -c conda requests-kerberos

output:
(myenv_conda) [localhost ~]$ conda install -c anaconda requests-kerberos
Collecting package metadata: done
Solving environment: done
....
....
....
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

回答by Taewon

Recommend to upgrade conda latest version.

建议升级 conda 最新版本。

conda install --quiet --yes conda=4.7.11 python -m pip install --upgrade pip==19.2.2

conda install --quiet --yes conda=4.7.11 python -m pip install --upgrade pip==19.2.2

Good lucky!

好幸运!