anaconda3 | 使用中常见错误

1. conda安装环境报错:Solving environment: failed with initial frozen solve.

$conda install -c bioconda hypo
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.

方案1:
首先,把你安装的anaconda卸了重装,反正我是这么干的,强迫症患者,这样干净

更新conda到最新版本:conda update -n base conda
再查一下conda版本:conda -V
并不是最新版本conda 4.7.11
第二次更新conda到最新版本:conda update -n base conda
第二次很重要!!!而且,这次它读环境的时候贼慢,我以为我电脑卡死机了呢,半年不动弹,等着就行了
更新完后再查一下conda版本:conda -V,发现是最新版本conda 4.7.11
然后执行:conda update --all
然后,装啥啥好使,整啥啥好使,啥啥都好使,好使就完事了!!!!!!

方案2:

# 更新conda
conda update -n base conda
conda update -all

# 修改频道 
conda config --add channels conda-forge
conda config --set channel_priority flexible

# 重新尝试

2. conda安装库时报错Solving environment: failed with initial frozen solve. Retrying with flexible solve.

conda安装库时报错:


图片.png

发现原因

后来查看错误信息的时候发现,原来是为了使用conda-forge的两条命令导致此错误。罪魁祸首是第二句。

conda config --add channels conda-forge
conda config --set channel_priority strict

解决方案:

解决方法:

conda config --add channels conda-forge
conda config --set channel_priority flexible

3. conda install遇到Segmentation fault错误

出错原因:可能是之前安装的时候网络不好导致中途中断,这个包只下载了一部分,但是并不完整。因此需要把之前下载的压缩包删除,再进行安装。

解决方案1:通过conda clean进行清理。

conda clean -a 删除所有包all,缓存 -i,锁定文件,无用缓存-p,tar包-t
conda clean -i 删除缓存index cache
conda clean -p 删除未使用的缓存。
conda clean -t 删除缓存tar包
conda clean -f 删除所有可写的程序包缓存,此项不包含在-a命令中
conda clean -c 删除由于正在使用而无法删除的临时文件
conda clean -a 

删除所有的缓存。

进入anaconda/pkgs 找到下载的不完整的压缩包,删除即可

解决方案2:在base环境中执行以下命令,清除缓存位置(…/anaconda3/pkgs/)中未下载完的文件。
在anaconda/pkgs 找到下载的不完整的压缩包,然后删除,再conda install这个包就没问题了

4. 使用conda命令安装时报错:CondaHTTPError

(1)方案1:亲测可用

$conda install anaconda-clean
Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.ustc.edu.cn/anaconda/pkgs/free/linux-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://mirrors.ustc.edu.cn/anaconda/pkgs/free/linux-64'

channels问题,个人认为比较快的解决方式是运行以下命令:把镜像里面的,https改为http

conda config --remove-key channels   #删除所有的channels,没运行通

#添加清华镜像源
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda 
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ 
conda config --set show_channel_urls yes    # 搜索时显示通道地址


#或者中科大镜像
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/linux-64
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes 

这次再安装bioconda 和 conda-forge是镜像

conda install -c bioconda  module
conda install -c conda-forge module

(2)方案2
换源吧:
  阿里云 http://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban) http://pypi.douban.com/simple/
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
(3)方案3(亲测可用)
打开.condarc文件,更改为如下:

vim ~/.condarc
channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
show_channel_urls: true
ssl_verify: false

(4)方案4

#首先先添加清华的镜像源 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
conda config --set show_channel_urls yes 

#如果无法解决,则删除channels配置文件中部分内容
 #具体操作如下: 

#1、快速创建channels配置文件的备份(保险起见) 
cp ~/.condarc{,.bak} 

#查看配置文件的内容 
cat ~/.condarc.bak 
channels: 
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ 
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ 
- https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud 
- defaults 
- https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda 
- https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/conda 
- bioconda 
- r 
- conda-forge 
show_channel_urls: true 
#2、删除部分内容
 ## 主要是删除此行:
 - defaults 

#修改后配置文件的内容如下: 
vim ~/.condarc 
channels: 
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ 
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ 
show_channel_urls: true 

5. 使用conda命令安装时报错:('Connection broken: OSError("(104, 'ECONNRESET')")', OSError("(104, 'ECONNRESET')"))

$conda install -c bioconda kmc
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/liuliu/software/anaconda3

  added / updated specs:
    - kmc


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.8.3                |           py37_0         2.8 MB
    kmc-3.1.2rc1               |       h2d02072_0        13.1 MB  bioconda
    ------------------------------------------------------------
                                           Total:        15.9 MB

The following NEW packages will be INSTALLED:

  kmc                bioconda/linux-64::kmc-3.1.2rc1-h2d02072_0

The following packages will be UPDATED:

  conda                                        4.8.2-py37_0 --> 4.8.3-py37_0


Proceed ([y]/n)? y   


Downloading and Extracting Packages
conda-4.8.3          | 2.8 MB    | ################################################################################################################################################################ | 100% 
kmc-3.1.2rc1         | 13.1 MB   | ##################################################9                                                                                                              |  32% 

('Connection broken: OSError("(104, \'ECONNRESET\')")', OSError("(104, 'ECONNRESET')"))

发生场景:在Ubuntu,使用Anaconda安装一些包。
这种问题大概就是下载国外的包什么的网速太慢了,下载失败。

解决办法:
用国内的镜像算了。这里我用的清华大学的一个镜像开源下的:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
在终端直接复制粘贴:

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

再使用conda install安装你想装的包吧

6. CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'

首次使用 source activate 命令激活虚拟环境

source activate R3.6
# 退出虚拟环境
conda deactivate

否则会报下面的错

7. PackagesNotFoundError: The following packages are not available from current channels

解决办法:将conda-forge添加到搜索路径上

首先,当出现这种报错时,应该首先尝试使用以下命令将conda-forge channel添加到你的channel列表中:

conda config --append channels conda-forge

它告诉conda在搜索软件包时也要在conda-forge channel上查看。

然后你就可以尝试利用如下命令再次安装

conda install 包名

原因在于:channel可以看成是托管python包的服务器,当无法通过标准channel获得python包时,社区驱动的conda-forge通常是一个很好的地点。大部分问题都可以利用这条语句解决。

8. Collecting package metadata (current_repodata.json): failed

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/linux-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

'https//repo.anaconda.com/pkgs/main/linux-64'

解决办法:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

https://www.csdn.net/gather_2b/MtTakgysMjczODEtYmxvZwO0O0OO0O0O.html

9 conda安装软件报兼容性问题的解决 Found conflicts! Looking for incompatible packages.failed.UnsatisfiableError

尝试对conda更新以解决兼容性问题

conda update --all
conda update conda

还是不行,报错如下

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.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \ 
Found conflicts! Looking for incompatible packages.                                    failed                                                                                     

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.31=0
  - feature:|@/linux-64::__glibc==2.31=0
  - **A程序** -> libgcc-ng[version='>=9.3.0'] -> __glibc[version='>=2.17']

Your installed version is: 2.31

添加国内镜像

conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/
conda config --add channels http://mirrors.aliyun.com/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

再进行安装,成功。

10. conda 尝试解决冲突但失败了。

为什么都已经创建新的环境了,conda 安装软件还是报错.

conda create -n merqury.1.3  
conda activate merqury.1.3   

conda install -c bioconda merqury
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.                                                                                                                                   failed

UnsatisfiableError:

这个错误可能是由一个或多个包之间的版本冲突导致的,conda尝试解决冲突但失败了。以下是一些可能的解决方案:

(1)使用mamba代替conda:Mamba是一个由conda社区开发的,与conda兼容的包管理器。它在处理包依赖关系及冲突问题时,通常会比conda更有优势。

执行以下命令安装mamba:

conda install mamba -n base -c conda-forge 

使用mamba安装Merqury:

mamba install -c bioconda merqury

(2)更新conda:有时候,这个问题可能是由于conda版本过旧引起的。你可以执行 conda update conda 来尝试更新conda。

(3)指定包版本:你可以尝试以特定版本安装包。例如,如果你想安装merqury的1.3版,你可以使用

conda install -c bioconda merqury=1.3。

不过在尝试这些解决方案之前,请记住在尝试安装任何包之前先激活你的环境。此外,你可能也需要确保你的Bioconda频道设置正确。你可以通过运行 conda config --show channels 来查看你目前的频道设置。如果你没有看到bioconda,你可以使用 conda config --add channels bioconda 来添加。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 195,783评论 5 462
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 82,360评论 2 373
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 142,942评论 0 325
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,507评论 1 267
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,324评论 5 358
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,299评论 1 273
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,685评论 3 386
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,358评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,652评论 1 293
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,704评论 2 312
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,465评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,318评论 3 313
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,711评论 3 299
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,991评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,265评论 1 251
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,661评论 2 342
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,864评论 2 335