conda升级
conda提示的升级方案为
1
|
conda update -n base conda
|
按照提示进行升级,但升级提示竟然会将原本3.6版本的python
降级至2.7
1
2
3
|
The following packages will be DOWNGRADED:
python: 3.6.6-h5001a0f_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge --> 2.7.15-h721da81_1008 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
|
这表明,conda源配置中的conda-forge
优先级过高,会出现一定的问题。检查一下原来的.condarc
文件。
1
2
3
4
5
6
7
8
9
10
|
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# - bioconda
# - conda-forge
# - defaults
- r
show_channel_urls: true
|
竟然将官方的defaults源注释掉了😓
不合理的顺序还可能会导致意想不到的错误,举例如下
并且举了一个例子,如果你有一个X包来自于conda-forge
,一个Y包来自于biconda
才能让Z包顺利工作.但是在YAML里面不知道X,Y那个包是来自于conda-forge
,那个是来自于bioconda
. 比如说conda-forge
有一个bzip2-1.0.6
,里面有对应的动态.so
文件,而defaults
也有bzip2-1.0.6
,但是没有.so
文件. 但是根据按照顺序,conda先从default
里面找到了bzip2-1.0.6
, 结果你就会在运行软件的时候找不到依赖文件.
但hoptop认为一定要将default源放在最后,我认为还是不能同意。因为上述的conda更新问题就是由于default源(或第三方镜像的default源)的优先级低于conda-forge
。因此,我认为至少conda-forge
的优先级不宜过高。
合理配置conda源顺序
参照前人的方案,我们需要将conda-forge
的优先级降低,仅作为官方源和bioconda
源的补充。修改后的配置如下:
1
2
3
4
5
6
7
8
9
10
|
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- bioconda
- defaults
- r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- conda-forge
show_channel_urls: true
|
参考来源
https://shengxin.ren/article/432
https://www.jianshu.com/p/7025139ac7d4
http://vincebuffalo.org/notes/2017/08/28/notes-on-anaconda.html