首页 > 其他分享 >anaconda3 | 使用中常见错误

anaconda3 | 使用中常见错误

时间:2024-03-19 22:33:19浏览次数:27  
标签:常见 mirrors cn 错误 anaconda3 -- anaconda conda edu

该篇在conda的常见错误中,非常有参考价值,为防止将来该网页信息丢失,将其copy记录下来,其原文链接等如下:
作者:生信师姐
原文链接:https://www.jianshu.com/p/4c7b9127cf83
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

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安装库时报错:

发现原因
后来查看错误信息的时候发现,原来是为了使用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

评论:我在本次conda环境安装中踩得最大坑

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

############私货#############
linux可执行文件添加到PATH环境变量的方法
https://www.cnblogs.com/joshua317/p/6899057.html

#vim里编辑文字:直接输入是没反应的。
#按一下a,就能输入了
#编辑完了之后按esc 然后按冒号 输入wq 回车

(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 来添加。

标签:常见,mirrors,cn,错误,anaconda3,--,anaconda,conda,edu
From: https://www.cnblogs.com/corrschi/p/18084078

相关文章

  • zhipuai的GLM-4模型API访问出现错误: ConnectError: TLS/SSL connection has been clo
    1简介访问zhipuai的GLM-4模型的API时,挂上梯子后访问失败,显示ConnectError:TLS/SSLconnectionhasbeenclosed(EOF)(_ssl.c:1131)报错信息如下{ "name":"ConnectError", "message":"TLS/SSLconnectionhasbeenclosed(EOF)(_ssl.c:1131)",......
  • 常见命令-history
    常见命令-historyhistory命令用于显示指定数目的指令命令,读取历史命令文件中的目录到历史命令缓冲区和将历史命令缓冲区中的目录写入命令文件。该命令单独使用时,仅显示历史命令,在命令行中,可以使用符号!执行指定序号的历史命令。例如,要执行第2个历史命令,则输入!2。历史命令......
  • 小白如何在服务器上配置环境(连接Linux服务器和anaconda3安装)
    由于服务器账号原因,悲惨的博主只能从头开始配置环境,但是博主脑子的缓存比较小,一周前配好的现在就忘掉了,为了防止再发生这种问题,博主从头开始记录一下。(连接Linux服务器和anaconda3安装)第一步连接到服务器1.安装插件(ReomoteSSH),安装好了之后点击左下角的><,点击“连接到主机.........
  • 第七章 Windows 10常见故障排查_实验案例一
    实验案例一:使用Windows安全模式解决系统故障1、实验环境    某公司的计算机全部安装了Windows10操作系统.公司员工由于操作不当,误安装了错误的驱动程序.导致计算机无法正常启动,现需要将错误的驱动程序卸载.2、需求描述通过安全模式进入操作系统。卸载掉存在兼容性......
  • Windows 10常见故障排查_实验案例(一)
    实验案例一:使用Windows安全模式解决系统故障1、实验环境    某公司的计算机全部安装了Windows10操作系统,公司员工由于操作不当,误安装了错误的驱动程。导致计算机无法正常启动,现需要将错误的驱动程序卸载。2、需求描述通过安全模式进入操作系统。卸载掉存在兼容性......
  • 第七章 Windows 10 常见故障排查_案例一
    实验案例一:使用Windows安全模式解决系统故障1、实验环境        某公司的计算机全部安装了Windows10操作系统,公司员工由于操作不当,误安装了错误的驱动程序,导致计算机无法正常启动,现需要将错误的驱动程序卸载,2、需求描述通过安全模式进入操作系统卸载掉存在兼容......
  • 解决CORS错误(Spring Boot)
    前言跨域(Cross-Origin)是指在Web开发中,当一个Web应用试图从一个源(域名、协议、端口组合)获取资源时,该请求的目标与当前页面的源不同。具体来说,当一个页面的JavaScript代码尝试向不同域名、协议或端口的服务器发送请求时,就会发生跨域请求。跨域请求是由浏览器实施的同源策略(Same-Ori......
  • 工作中Java最常见的6种OOM问题
    前言今天,跟大家一起聊聊线上服务出现OOM问题的6种场景,希望对你会有所帮助。1堆内存OOM堆内存OOM是最常见的OOM了。出现堆内存OOM问题的异常信息如下:java.lang.OutOfMemoryError:Javaheapspace此OOM是由于JVM中heap的最大值,已经不能满足需求了。举个例子:publicclass......
  • Pytorch相关错误及解决方案
    Pytorch相关错误及解决方案AttributeError:module'resource'hasnoattribute'getpagesize错误信息AttributeError:module'resource'hasnoattribute'getpagesize错误描述在Pycharm中启动JupyterNotebook时,弹窗此错误。解决方案发现是因为我在项目的目录中......
  • 如何返回标准 API 的错误信息
    --lv_msg_count:为api返回参数,为消息的个数。--根据消息的具体情况,循环次数要做相应调整。加大次数,消息内容就多,反之则少.iflv_msg_count>0thenlv_mesg:=chr(10)||substr(fnd_msg_pub.get(fnd_msg_pub.g_first,fnd_api.g_false),......