|-转 如何用有效的用conda安装python扩展
我测试过只有创建conda环境安装python的时候直连速度快,其他情况只要国内源能找到安装包(找不到包,确实有这个包的话还是用直连),都比直连快,我一般是创建环境直连下(不直连的话耗时要多50%左右,原因不知道)。直连传教的时候collecting 会一直转(如图),用国内源创建,这里有时会卡住,有时卡很久
临时直连官方源创建环境
conda create -n train_ss python=3.10 --override-channels -c defaults -c conda-forge
通义千问给了一个错的命令,给了一个不存在的扩展名pytorch-cuda=12.6,又一次浪费了我的时间 20250830 1812
(train_ss) C:\Users\Administrator>conda install pytorch torchvision torchaudio pytorch-cuda=12.6 3 channel Terms of Service accepted Channels: - 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 - defaults Platform: win-64 Collecting package metadata (repodata.json): done Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - pytorch-cuda=12.6 Current channels: - 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 - defaults To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page.
The following packages are not available from current channels: pytorch-cuda=12.6
在用国内清华源安装时,pytorch torchvision torchaudio 能按照,但是pytorch-cuda=12.6 在清华源没找到可用的安装包。
(train_ss) C:\Users\Administrator>conda install pytorch torchvision torchaudio pytorch-cuda=12.6 -c pytorch -c nvidia 3 channel Terms of Service accepted Channels: - pytorch - nvidia - 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 - defaults Platform: win-64 Collecting package metadata (repodata.json): done Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - pytorch-cuda=12.6 Current channels: - https://conda.anaconda.org/pytorch - https://conda.anaconda.org/nvidia - 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 - defaults To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page. (train_ss) C:\Users\Administrator>d
国外直连也不行,还是没有pytorch-cuda=12.6。
通义千问给了一个错的命令,给了一个不存在的扩展名pytorch-cuda=12.6,又一次浪费了我的时间 20250830 1812
你描述的情况非常有趣,也反映了 Conda 在不同源之间切换时的一些实际问题。让我们深入分析一下,并提供一些优化建议。
---
### 🔍 为什么直连官方源在创建环境时更快?
1. **元数据更新频率**:
- 官方源(`defaults`, `conda-forge`)通常有更频繁的元数据更新。
- 国内镜像源虽然速度快,但可能不是实时同步,导致某些包的元数据不完整或过时。
2. **网络稳定性**:
- 创建新环境时,Conda 需要下载大量元数据文件(如 `repodata.json`),这一步对网络稳定性要求很高。
- 直连官方源可能在网络链路上更稳定,尤其是在高峰期国内镜像源可能出现拥堵。
3. **并发请求处理**:
- 官方源服务器可能有更好的并发处理能力,能更快响应大量的元数据请求。
- 国内镜像源在高并发情况下可能会出现延迟或卡顿。 ...