系统版本 ubuntu 22.04 + cudnn12.2.2
torch版本同embodiedscan安装教程:
pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3
在按照https://www.cnblogs.com/mstk/p/16585508.html 的教程进行安装时出现许多报错
记录如下:
第一次报错:
RuntimeError:
The detected CUDA version (12.2) mismatches the version that was used to compile
检测到的cuda版本与安装的torch_cuda版本不符
参考:https://blog.csdn.net/weixin_43536737/article/details/134350226?spm=1001.2014.3001.5506
把检查版本的代码注释掉就行
第二次报错:
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/root/anaconda3/envs/embodiedscan/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1740, in _run_ninja_build
subprocess.run(
File "/root/anaconda3/envs/embodiedscan/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '12']' returned non-zero exit status 1.
....
RuntimeError: Error compiling objects for extension
先使用 pip uninstall ninja 把ninja卸载了就行
第三次报错:
1 error detected in the compilation of "/root/experiments/EmbodiedScan/MinkowskiEngine/src/broadcast_gpu.cu".
error: command '/usr/local/cuda/bin/nvcc' failed with exit code 2
是我的环境变量中没有添加cuda的路径
使用vim ~/.bashrc
在文件末尾添加:
# cuda
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
输入 nvcc -V 能正常输出版本就行
第四次报错:
1 error detected in the compilation of "/root/experiments/EmbodiedScan/MinkowskiEngine/src/broadcast_gpu.cu".
error: command '/usr/local/cuda-12.2/bin/nvcc' failed with exit code 2
按照:https://github.com/NVIDIA/MinkowskiEngine/issues/543
在几个文件中加上这些头文件后,再次安装,终于可以了!
测试安装是否成功:
$ python
$ >>> import MinkowskiEngine as ME
// 没有报错说明 OK
$ >>> exit()
$ python -c "import MinkowskiEngine as ME; print(ME.__version__)"
$ 0.5.2
第五次报错:
cblas.h: No such file or directory
failed with exit code 1
解决办法
apt-get install libopenblas-dev