在执行Anaconda命令的时候遇到The following packages are causing the inconsistency:

在执行Anaconda命令的时候遇到The following packages are causing the inconsistency:

(base) liuchang@PauldeMacBook-Pro  ~  conda install anaconda

Collecting package metadata (current_repodata.json): done
Solving environment: -
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

- https://repo.anaconda.com/pkgs/main/osx-64::dask==0.19.1=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::anaconda==5.3.0=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::mkl_fft==1.0.4=py37h5d10147_1
- https://repo.anaconda.com/pkgs/main/osx-64::scikit-learn==0.19.2=py37h4f467ca_0
- https://repo.anaconda.com/pkgs/main/osx-64::bottleneck==1.2.1=py37h1d22016_1
- https://repo.anaconda.com/pkgs/main/osx-64::h5py==2.8.0=py37h878fce3_3
- https://repo.anaconda.com/pkgs/main/osx-64::statsmodels==0.9.0=py37h1d22016_0
- https://repo.anaconda.com/pkgs/main/osx-64::pytest-arraydiff==0.2=py37h39e3cac_0
- https://repo.anaconda.com/pkgs/main/osx-64::scipy==1.1.0=py37h28f7352_1
- https://repo.anaconda.com/pkgs/main/osx-64::matplotlib==2.2.3=py37h54f8f79_0
- https://repo.anaconda.com/pkgs/main/osx-64::bkcharts==0.2=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::pywavelets==1.0.0=py37h1d22016_0
- https://repo.anaconda.com/pkgs/main/osx-64::patsy==0.5.0=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::imageio==2.4.1=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::mkl_random==1.0.1=py37h5d10147_1
- https://repo.anaconda.com/pkgs/main/osx-64::numpy-base==1.15.1=py37h8a80b8c_0
- https://repo.anaconda.com/pkgs/main/osx-64::numba==0.39.0=py37h6440ff4_0
- https://repo.anaconda.com/pkgs/main/osx-64::odo==0.5.1=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::pytables==3.4.4=py37h13cba08_0
- https://repo.anaconda.com/pkgs/main/osx-64::datashape==0.5.4=py37_1
- https://repo.anaconda.com/pkgs/main/osx-64::seaborn==0.9.0=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::scikit-image==0.14.0=py37h0a44026_1
- https://repo.anaconda.com/pkgs/main/osx-64::bokeh==0.13.0=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::numexpr==2.6.8=py37h1dc9127_0
- https://repo.anaconda.com/pkgs/main/osx-64::pandas==0.23.4=py37h6440ff4_0
- https://repo.anaconda.com/pkgs/main/osx-64::pytest-doctestplus==0.1.3=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::astropy==3.0.4=py37h1de35cc_0
- https://repo.anaconda.com/pkgs/main/osx-64::mkl-service==1.1.2=py37h6b9c3cc_5
- https://repo.anaconda.com/pkgs/main/osx-64::blaze==0.11.3=py37_0
- https://repo.anaconda.com/pkgs/main/osx-64::pytest-astropy==0.4.0=py37_0
  failed with initial frozen solve. Retrying with flexible solve.
  Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.



报错说是环境中的一些包发生了冲突。于是我使用conda info查看了我的conda的基本信息

```ABAP
active environment : base
  active env location : /Users/liuchang/anaconda3
          shell level : 1
     user config file : /Users/liuchang/.condarc
populated config files : /Users/liuchang/.condarc
        conda version : 4.7.12
  conda-build version : 3.18.9
       python version : 3.6.8.final.0
     virtual packages :
     base environment : /Users/liuchang/anaconda3  (writable)
         channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/osx-64
                        https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                        https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-64
                        https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
                        https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/osx-64
                        https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch
        package cache : /Users/liuchang/anaconda3/pkgs
                        /Users/liuchang/.conda/pkgs
     envs directories : /Users/liuchang/anaconda3/envs
                        /Users/liuchang/.conda/envs
             platform : osx-64
           user-agent : conda/4.7.12 requests/2.22.0 CPython/3.6.8 Darwin/20.6.0 OSX/10.16
              UID:GID : 501:20
           netrc file : None
         offline mode : False

于是我发现了第一个问题,我明明设置的是清华的镜像源啊,怎么冲突的是https://repo.anaconda.com/pkgs的呢?我打开condarc文件进行修改:open ~/.condarc

show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

但是问题仍然存在,于是我去继续查找答案。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9oZlU1cW-1632659566912)(/Users/liuchang/Library/Application Support/typora-user-images/截屏2021-09-26 16.55.25.png)]

这个哥们的问题与我的很相似。在这个问题下,人们给出了各种各样的解决办法。我开始尝试…

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6sB3QaXw-1632659566921)(/Users/liuchang/Library/Application Support/typora-user-images/截屏2021-09-26 19.12.40.png)]

报错原因一直是上面的那样。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Kj25BxJH-1632659566924)(/Users/liuchang/Library/Application Support/typora-user-images/截屏2021-09-26 19.35.15.png)]

这个方法似乎对很多人都有效,我决定等一下这个命令的运行结果,/呃,仍然报错。

failed with initial frozen solve. Retrying with flexible solve.

最终我解决了这个问题,我是通过一个个地删除这些存在冲突依赖的旧包来进行解决的。

其中我用到的命令是 conda install --force packagename,这个–force很重要,是我通过查阅conda的官方文档得到的。而conda的官方文档是我在使用搜索引擎搜索bug的过程中得到的,由此可见,**查阅官方的文档是很多人解决bug的重要方式。**https://docs.conda.io/projects/conda/en/latest/user-guide/index.html

很多时候,中国人debug过程慢的原因就是因为英语水平太菜,或者没有耐心读英文。

下面这个博客对这个问题理解得更深入一些

showteeth’s blog

  • 6
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值