安装OpenPCDet碰到的问题

Ubuntu18.04重新安装了,现在要把OpenPCDet也重新装上,按照官方的教程来,一路安装好了torch, numpy之类的东西,没碰到问题,之后 开始安装OpenPCDet,然后就碰到了下面的问题,

问题1  IndexError: list index out of range


(openmmlab) user@MS-7816:~/devAI/OpenPCDet$ python setup.py develop
No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
running develop
running egg_info
writing pcdet.egg-info/PKG-INFO
writing dependency_links to pcdet.egg-info/dependency_links.txt
writing requirements to pcdet.egg-info/requires.txt
writing top-level names to pcdet.egg-info/top_level.txt
reading manifest file 'pcdet.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'pcdet.egg-info/SOURCES.txt'
running build_ext
building 'pcdet.ops.iou3d_nms.iou3d_nms_cuda' extension
Traceback (most recent call last):
  File "setup.py", line 114, in <module>
    'src/sampling_gpu.cu',
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/setuptools/command/develop.py", line 34, in run
    self.install_for_development()
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/setuptools/command/develop.py", line 114, in install_for_development
    self.run_command('build_ext')
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 709, in build_extensions
    build_ext.build_extensions(self)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
    depends=ext.depends)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 525, in unix_wrap_ninja_compile
    cuda_post_cflags = unix_cuda_flags(cuda_post_cflags)
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 424, in unix_cuda_flags
    cflags + _get_cuda_arch_flags(cflags))
  File "/home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1562, in _get_cuda_arch_flags
    arch_list[-1] += '+PTX'
IndexError: list index out of range

然后到网上查看了一圈,说是nvidia没安装好,解决办法如下,

可见,最初的错误是:

    CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero.


https://github.com/pytorch/pytorch/issues/49081#issuecomment-766793705
上找到解决方法:

    yurunsheng1 commented on 25 Jan

    apt-get install nvidia-modprobe

    This works for me.

这个也work for me.

    The nvidia-modprobe utility is used by user-space NVIDIA driver components to make sure the NVIDIA kernel module is loaded and that the NVIDIA character device files are present. These facilities are normally provided by Linux distribution configuration systems such as udev.

然后我试了一下,不行,依然报错,不过,我另外检查了一下我的nividia驱动,

$ nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

nvidia驱动找不到,这个问题有点怪,因为我确定安装过了。于是找到自己以前的贴子,

《Ubuntu18.04查看显卡信息并安装NVDIA显卡驱动driver + Cuda + Cudnn》

https://blog.csdn.net/tanmx219/article/details/107591416

$ ubuntu-drivers devices
WARNING:root:_pkg_get_support nvidia-driver-390: package has invalid Support Legacyheader, cannot determine support level
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001B06sv00001458sd00003752bc03sc00i00
vendor   : NVIDIA Corporation
model    : GP102 [GeForce GTX 1080 Ti]
driver   : nvidia-driver-470-server - distro non-free
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-495 - distro non-free
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-460 - distro non-free
driver   : nvidia-driver-460-server - distro non-free
driver   : nvidia-driver-470 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

发现推荐的是

nvidia-driver-470 - distro non-free recommended

根据上面的链接,找到官方地址:

NVIDIA DRIVERS Linux x64 (AMD64/EM64T) Display Driver

下载下来后安装好,

$ sudo sh NVIDIA-Linux-x86_64-470.86.run

安装过程可以参考我上面给出的链接《Ubuntu18.04查看显卡信息并安装NVDIA显卡驱动driver + Cuda + Cudnn》。

检查一下,OK了,

$ nvidia-smi
Thu Dec  2 10:40:45 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.86       Driver Version: 470.86       CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| 32%   27C    P5    43W / 300W |      0MiB / 11178MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

开始安装,

(openmmlab) matthew@matthew-MS-7816:~/devAI$  cd OpenPCDet
(openmmlab) matthew@matthew-MS-7816:~/devAI/OpenPCDet$ python setup.py develop

一路顺利,不过很快第二个错误出现了,

各个包的版本问题,如llvmlite ,numpy, pillow, etc.

error: llvmlite 0.38.0rc1 is installed but llvmlite<0.38,>=0.37.0rc1 is required by {'numba'}

没有什么特别的办法,一路 上改版本,一个个地装,全部安装过程在下面,

(openmmlab) matthew@matthew-MS-7816:~/devAI/OpenPCDet$ pip install llvmlite==0.37
Collecting llvmlite==0.37
  Downloading llvmlite-0.37.0-cp37-cp37m-manylinux2014_x86_64.whl (26.3 MB)
     |████████████████████████████████| 26.3 MB 115 kB/s 
Installing collected packages: llvmlite
  Attempting uninstall: llvmlite
    Found existing installation: llvmlite 0.38.0rc1
    Uninstalling llvmlite-0.38.0rc1:
      Successfully uninstalled llvmlite-0.38.0rc1
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.
pcdet 0.5.0+3fa8b51 requires numpy<=1.20, but you have numpy 1.21.2 which is incompatible.
numba 0.54.1 requires numpy<1.21,>=1.17, but you have numpy 1.21.2 which is incompatible.
Successfully installed llvmlite-0.37.0

(openmmlab) matthew@matthew-MS-7816:~/devAI/OpenPCDet$ pip install numpy==1.20
Collecting numpy==1.20
  Downloading numpy-1.20.0-cp37-cp37m-manylinux2010_x86_64.whl (15.3 MB)
     |████████████████████████████████| 15.3 MB 12 kB/s 
Installing collected packages: numpy
  Attempting uninstall: numpy
    Found existing installation: numpy 1.21.2
    Uninstalling numpy-1.21.2:
      Successfully uninstalled numpy-1.21.2
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.
imageio 2.13.1 requires pillow>=8.3.2, but you have pillow 8.3.1 which is incompatible.
Successfully installed numpy-1.20.3

(openmmlab) matthew@matthew-MS-7816:~/devAI/OpenPCDet$ pip install pillow==8.3.2
Collecting pillow==8.3.2
  Downloading Pillow-8.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
     |████████████████████████████████| 3.0 MB 482 kB/s 
Installing collected packages: pillow
  Attempting uninstall: pillow
    Found existing installation: Pillow 8.3.1
    Uninstalling Pillow-8.3.1:
      Successfully uninstalled Pillow-8.3.1
Successfully installed pillow-8.3.2
(openmmlab) matthew@matthew-MS-7816:~/devAI/OpenPCDet$ python setup.py develop
.......................................
Using /home/matthew/anaconda3/envs/openmmlab/lib/python3.7/site-packages
Finished processing dependencies for pcdet==0.5.0+3fa8b51
(openmmlab) matthew@matthew-MS-7816:~/devAI/OpenPCDet$



然后python setup.py develop搞定。

最后,晒一张跑通的PV-RCNN图片

 

版权声明:本文为CSDN博主「高精度计算机视觉」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/tanmx219/article/details/121672106

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

yolov5模型训练(自制数据集)

这些东西是我从什么都不知道 熬了十天晚上左右 摸打滚爬于csdn、github总结出来的 在训练过程中遇到什么问题可以在评论区留言或者私信 看到会一一回复 呜呜呜/(ㄒoㄒ)/~~ 1.制作数据集 1.1 lableimg使用&#xff08