问题:
有时侯一些诸如机器学习相关论文中的code源码,在复现时会要求引入environment.yml,基于作者的依赖配置来创建项目的虚拟环境。
在执行环境创建命令时,可能会出现pip报错,如下:
ERROR: Could not find a version that satisfies the requirement 包名 (from versions: none)
ERROR: No matching distribution found for robotframework
解决:
将environment.yml中pip后的依赖全部删除,创建一个空的虚拟环境,随后手动添加需要的依赖,例如:
a.注释依赖项,之后手动pip安装
name: xxxx
channels:
- xformers
- pytorch
- nvidia
- conda-forge
- defaults
dependencies:
- pip
- python=3.9.6
# - pip:
# - torch
# - torchvision
# - omegaconf
# - torchmetrics==0.10.3
# - fvcore
# - iopath
# - xformers==0.0.18
# - opencv-python
# - pycocotools
# - matplotlib
# - onnxruntime
# - onnx
# - scipy
# - ffmpeg
# - hydra-colorlog
# - hydra-core
# - gdown
# - pytorch-lightning==1.8.1
# - pandas
# - ruamel.yaml
# - pyrender
# - wandb
# - distinctipy
# bop https://github.com/thodan/bop_toolkit.git
b.利用国内镜像安装
pip install 包名-i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
ps :--trusted-host pypi.douban.com 这是为了获得ssl证书的认证
常见pip镜像源(国内源)
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/