facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.26k stars 5.45k forks source link

OSError: libcuda.so.1: cannot open shared object file: No such file or directory #938

Open wzhai-hub opened 5 years ago

wzhai-hub commented 5 years ago

issue:OSError: libcuda.so.1: cannot open shared object file: No such file or directory

root@3fe905bb1864:/detectron# python tools/infer_simple.py --cfg configs/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml --output-dir /tmp/detectron-visualizations --image-ext jpg --wts https://dl.fbaipublicfiles.com/detectron/35861858/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml.02_32_51.SgT4y1cO/output/train/coco_2014_train:coco_2014_valminusminival/generalized_rcnn/model_final.pkl demo WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode. WARNING:root:Debug message: libcuda.so.1: cannot open shared object file: No such file or directory

Found Detectron ops lib: /usr/local/caffe2_build/lib/libcaffe2_detectron_ops_gpu.so Traceback (most recent call last): File "tools/infer_simple.py", line 49, in c2_utils.import_detectron_ops() File "/detectron/detectron/utils/c2.py", line 42, in import_detectron_ops dyndep.InitOpsLibrary(detectron_ops_lib) File "/usr/local/caffe2_build/caffe2/python/dyndep.py", line 50, in InitOpsLibrary _init_impl(name) File "/usr/local/caffe2_build/caffe2/python/dyndep.py", line 63, in _init_impl ctypes.CDLL(path) File "/usr/lib/python2.7/ctypes/init.py", line 362, in init self._handle = _dlopen(self._name, mode) OSError: libcuda.so.1: cannot open shared object file: No such file or directory root@3fe905bb1864:/ewezhai/detectron#

root@3fe905bb1864:/# nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2017 NVIDIA Corporation Built on Fri_Sep__1_21:08:03_CDT_2017 Cuda compilation tools, release 9.0, V9.0.17

nQuant commented 5 years ago

Check if PATH contains /usr/local/cuda-9.0/bin and LD_LIBRARYPATH contains /usr/local/cuda-9.0/lib64_

echo $PATH echo $LD_LIBRARY_PATH

If it is not, you can add them with:

export PATH="$PATH:/usr/local/cuda-9.0/bin" export LD_LIBRARY_PATH="/usr/local/cuda-9.0/lib64" #if LD_LIBRARY_PATH was empty export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64" #if not

(Those exports are not permanent, you have to follow those instructions.)

Run command ldconfig

Then you have to rebuild caffe2 and detectron.