ImportError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
这是我在搭建mmpose环境进行最终环境测试遇到的问题,记录一下
第一步:判定pytorch版本是否相符
这个其实大部分人都不会犯错,我这边检查发现torch版本配置没问题,适合cuda版本相适配的
检查mmcv版本的问题
官网这里给出的是大致版本适配,但实际上我就是这里出问题的
因为具体在这这些里面的小版本中还是要注意兼容的情况的
我的解决办法
首先我卸载了mmcv,然后重新安装
之后控制台报错
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
mmpose 1.3.2 requires mmdet<3.3.0,>=3.0.0, but you have mmdet 3.3.0 which is incompatible.
mmdet 3.3.0 requires mmcv<2.2.0,>=2.0.0rc4, but you have mmcv 2.2.0 which is incompatible.
Successfully installed mmcv-2.2.0
也就是说mmcv版本是不适配的,然后我把报错扔给大模型给出了建议的降级版本,
之后重新安装,最终成功运行
这里给出我的相关版本
(mmpose01) [class1@node01 mmpose]$ python -c "import torch; print(torch.__version__)"
2.1.1+cu118
(mmpose01) [class1@node01 mmpose]$ pip show torch torchvision torchaudio
Name: torch
Version: 2.1.1+cu118
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /home/class1/.conda/envs/mmpose01/lib/python3.8/site-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, triton, typing-extensions
Required-by: efficientnet-pytorch, lpips, pytorch-triton-rocm, torch-ema, torchaudio, torchvision
---
Name: torchvision
Version: 0.16.1+cu118
Summary: image and video datasets and models for torch deep learning
Home-page: https://github.com/pytorch/vision
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Location: /home/class1/.conda/envs/mmpose01/lib/python3.8/site-packages
Requires: numpy, pillow, requests, torch
Required-by: lpips, mmpose
---
Name: torchaudio
Version: 2.1.1+cu118
Summary: An audio package for PyTorch
Home-page: https://github.com/pytorch/audio
Author: Soumith Chintala, David Pollack, Sean Naren, Peter Goldsborough, Moto Hira, Caroline Chen, Jeff Hwang, Zhaoheng Ni, Xiaohui Zhang
Author-email: soumith@pytorch.org
License:
Location: /home/class1/.conda/envs/mmpose01/lib/python3.8/site-packages
Requires: torch
Required-by:
(mmpose01) [class1@node01 mmpose]$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
(mmpose01) [class1@node01 mmpose]$ pip list | grep mm
cumm-cu118 0.6.3
mmcv 2.1.0
mmdet 3.2.0
mmengine 0.9.0
mmpose 1.3.2
(mmpose01) [class1@node01 mmpose]$
在该环境下我是可以成功运行的