我试图从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 list—revisions,选择一个修订号,然后使用conda install—revision[#]一步一步地往回走,直到一切都恢复正常。

其他回答

你可能用python 2.7安装了anaconda,但后来你使用了python 3.x。因此,您将得到一条错误消息。在我的情况下,我通过使用python 2.7激活anaconda来解决这个问题:

conda create --name py2 python=2.7

最终解决方案:

conda activate base
conda install anaconda
conda update --all

适用于Windows 10和Ubuntu 18.04(归功于@MF。OX for ubuntu)。

为我解决了以下问题:

环境不一致 警告conda.base.context: use_only_tar_bz2 (632)

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

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

假设有如下情况,

> 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
)