使用conda配置环境时遇到的问题

(自用,希望对您也有一点点帮助)
conda documentation

在配置环境时,爆出了包找不到的错误

解决 :因为使用conda下载包的时候,默认安装包从defaults通道,但这里的包实际上更新比较慢,所以我使用了如下命令让conda-forge通道为优先级最高的通道(conda-forge是社区驱动的,更新包较快)(conda-forge is a community effort that provides conda packages for a wide range of software.)

使用以下命令查看配置的所有通道

复制代码
conda config --show channels

Make sure you have conda >=4.9:

复制代码
conda --version
conda update conda

Add conda-forge as the highest priority channel:

复制代码
conda config --add channels conda-forge

Activate strict channel priority (strict will be activated by default in conda 5.0):

复制代码
conda config --set channel_priority strict

但是这样的话,如果下载一个包,但是在conda-forge通道找不到,也不会在默认通道找。如果出现这种报错:

复制代码
LibMambaUnsatisfiableError: Encountered problems while solving:
  - package cudatoolkit-9.0-1 is excluded by strict repo priority

可以尝试改成这样:

复制代码
conda config --set channel_priority flexible

出现了网络问题

  1. 使用镜像源
    有如下镜像源:

    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2

  2. 安装时使用mamba而不是conda
    (mamba能够加速安装)

    安装mamba

    conda install mamba -c conda-forge

    使用mamba创建环境

    mamba env create -f botsay.yaml

    或者如果还有问题,使用mamba分步安装

    mamba create -n botsay python=3.10
    mamba install -n botsay pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c conda-forge

使用.yaml文件一次性创建环境时遇到网络问题

可以把.yaml文件发送给deepseek让它写出分步安装的代码,依次安装。

CondaHTTPError: HTTP 000 CONNECTION

复制代码
Collecting package metadata (repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/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//conda.anaconda.org/conda-forge/linux-64'

『技术随手学』解决CondaHTTPError: HTTP 000 CONNECTION 问题

其中ssl_verify: false 是 Conda 配置中一个关于SSL证书验证的设置。简单来说,它让Conda在下载包时跳过对服务器SSL证书的检查,从而解决因SSL证书问题导致的网络连接错误
show_channel_urls: true 是一个 Conda 配置选项,它的作用是:在安装、更新或列出包时,显示每个软件包是从哪个通道(channel)URL下载的。
修复Conda连接异常:CondaHTTPError HTTP 000 CONNECTION FAILED故障排除指南

相关推荐
emo_2b9 小时前
Pycharm配置conda解释器时遇到的问题及解决方法
linux·pycharm·conda
Είναι η κοπέλα2 天前
llama.cpp 与 GGUF 格式:本地大模型的“裸引擎“
开发语言·人工智能·pytorch·python·conda
Είναι η κοπέλα4 天前
显存计算与模型选择:你的显卡能跑多大的模型
人工智能·pytorch·python·开源·conda
天蓝蓝的本我4 天前
conda日常用到的命令积累1-登录linux,安装pycharm
linux·pycharm·conda
Είναι η κοπέλα6 天前
Python 虚拟环境:venv、conda 与 Python 版本选择全解
开发语言·python·conda
夏天拐跑了西瓜9 天前
一文入门LangChain:从框架认知到构建你的第一个AI Agent
python·langchain·conda·agent
weixin_461769409 天前
机械臂SDK运行日志
conda·sdk
三点水-here10 天前
从 Miniconda 迁移到 Miniforge3 全记录:安装、配置、环境迁移与排错实录
python·conda
MI_farmer11 天前
Anaconda 安装在 D 盘但虚拟环境跑到 C 盘,以及 Conda PermissionError: WinError 5 的解决方法
c语言·开发语言·conda
伞伞悦读19 天前
【第39期】Python 第三方包安装详解:pip、conda、requirements、版本锁定和镜像源
python·conda·pip