我试图从anaconda更新或安装新包,最近,这条消息出现了:

The environment is inconsistent, please check the package plan carefully
The following package are causing the inconsistency:

   - defaults/win-32::anaconda==5.3.1=py37_0

done

我尝试用conda clean -all,然后用conda update -all,但它仍然存在。

第二次信息

active environment : base
    active env location : C:\Users\NAME\Continuum
            shell level : 1
       user config file : C:\Users\NAME\.condarc
 populated config files : C:\Users\NAME\.condarc
          conda version : 4.6.11
    conda-build version : 3.17.7
         python version : 3.7.3.final.0
       base environment : C:\Users\NAME\Continuum  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-32
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-32
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-32
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-32
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\NAME\Continuum\pkgs
                          C:\Users\NAME\.conda\pkgs
                          C:\Users\NAME\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\NAME\Continuum\envs
                          C:\Users\NAME\.conda\envs
                          C:\Users\NAME\AppData\Local\conda\conda\envs
               platform : win-32
             user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17763
          administrator : False
             netrc file : None
           offline mode : False

当前回答

命令conda install -c anaconda anaconda对我来说很管用。对于我的设置,我需要指定通道,否则它将无法工作。在终端中运行命令后,系统提示我更新一个发现不一致的包列表。如果没有这个步骤,我就无法分别使用conda install <package_name>或conda update <package_name安装或更新任何包。

其他回答

遇到同样的问题,其他的解决方案都对我不起作用。最后不得不卸载并重新安装conda,然后重新安装我所有的库。

假设有如下情况,

> conda update -c intel --all
Collecting package metadata: done
Solving environment: |
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - intel/win-64::ipython==6.3.1=py36_3
  - intel/win-64::prompt_toolkit==1.0.15=py36_2
done

正如在其他回答中提到的,其思想是对不一致的包进行某种重新安装。

因此,通过一些复制-粘贴,你可以:

> conda install intel/win-64::ipython==6.3.1=py36_3
Collecting package metadata: done
Solving environment: /
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - intel/win-64::ipython==6.3.1=py36_3
  - intel/win-64::prompt_toolkit==1.0.15=py36_2
done

## Package Plan ##

  environment location: c:\conda

  added / updated specs:
    - ipython


The following NEW packages will be INSTALLED:

  jedi               intel/win-64::jedi-0.12.0-py36_2
  parso              intel/win-64::parso-0.2.0-py36_2
  pygments           intel/win-64::pygments-2.2.0-py36_5
  wcwidth            intel/win-64::wcwidth-0.1.7-py36_6


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(你将不得不重复所有的包)


我的“快捷方式”

或者,编写一个(丑陋的)一行程序(这应该适用于Windows和其他平台)

注意:通过“ORIGINAL_COMMAND”,我指的是给您错误消息的任何命令(理想情况下没有任何其他副作用)

<ORIGINAL_COMMAND> 2>&1 | python -c "import sys,re,conda.cli; conda.cli.main('conda','install','-y',*re.findall(r'^\s*-\s*(\S+)$',sys.stdin.read(),re.MULTILINE))"

展开上面的一行代码:

from re import findall, MULTILINE
from sys import stdin
from conda.cli import main

main(
    "conda", "install", "-y",
    "--force",  # Maybe add a '--force'/'--force-reinstall' (I didn't add it for the one-liner above)
    *findall(r"^\s*-\s*(\S+)$", stdin.read(), MULTILINE)  # Here are the offenders
)

对我有效的是

`conda remove <offending_packagename>`, 
`conda update --all` 

最后

`conda install <offending_packagename>`.

不一致是由于包的不同版本以及它们相互冲突的依赖关系造成的。

conda update --all

这个命令更新所有的包,然后conda自己解决不一致的问题。

对于我们这些拥有miniconda并且不能/不想安装anaconda的人来说:接受的答案在调整时是有效的。

第二秒第二秒 第二次更新——全部

本想评论的,但我的名声太低了。