如何在SageMaker推理端点中成功安装mmcv-full?
解决mmcv-full安装问题的可行方案
一、解决pip安装超时/被中断的问题
- 换国内PyPI镜像源提速,避免因下载慢被中断:
执行命令:pip install mmcv-full -i https://pypi.tuna.tsinghua.edu.cn/simple
要是需要指定适配PyTorch和CUDA的版本,用这个格式:pip install mmcv-full=={你的目标版本} -f https://download.openmmlab.com/mmcv/dist/{CUDA版本}/{PyTorch版本}/index.html -i https://pypi.tuna.tsinghua.edu.cn/simple
举个例子,CUDA 11.3、PyTorch 1.12.0对应的命令是:pip install mmcv-full==1.7.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12.0/index.html -i https://pypi.tuna.tsinghua.edu.cn/simple - 延长pip超时时间,防止因下载慢触发中断:
命令:pip install mmcv-full --default-timeout=1000 -i https://pypi.tuna.tsinghua.edu.cn/simple
二、修复mim后端工作进程错误
- 先把mim更到最新版:
pip install --upgrade openmim - 清理mim缓存后重试安装:
- 执行
mim clean - 再运行
mim install mmcv-full
- 执行
- 要是还报错,检查环境是否有冲突——比如是不是没激活虚拟环境,或者多个Python版本混用。建议新建干净的虚拟环境重试:
# 创建虚拟环境 python -m venv mmcv-env # Windows激活环境 mmcv-env\Scripts\activate # Linux/macOS激活环境 source mmcv-env/bin/activate # 先装对应版本的PyTorch,再用mim装mmcv-full pip install torch torchvision torchaudio mim install mmcv-full
三、备选方案:手动安装预编译包
- 找到对应你系统、CUDA、PyTorch版本的mmcv-full预编译.whl文件,下载到本地后执行:
pip install /你下载的文件路径/mmcv-full-{版本信息}.whl
比如文件是mmcv_full-1.7.0-cp38-cp38-linux_x86_64.whl,就运行pip install mmcv_full-1.7.0-cp38-cp38-linux_x86_64.whl
内容的提问来源于stack exchange,提问作者Diego Rodea
相关产品推荐
相关产品推荐

