I've tried to install detectron2 as the guide in installation.md file. First I make an virtual environment with mkvirtual then installed all requirements like fvcore, pycocotools...and I imported these libs in python3, ok. Next I cloned git and installed detectron2.
(detectron2) xxx@server1:~/tienpv_DO_NOT_REMOVE/detectron2_repo$ python3
Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import detectron2
>>> from detectron2 import model_zoo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xxx/tienpv_DO_NOT_REMOVE/detectron2_repo/detectron2/model_zoo/__init__.py", line 7, in <module>
from .model_zoo import get, get_config_file
File "/home/xxx/tienpv_DO_NOT_REMOVE/detectron2_repo/detectron2/model_zoo/model_zoo.py", line 7, in <module>
from detectron2.modeling import build_model
File "/home/xxx/tienpv_DO_NOT_REMOVE/detectron2_repo/detectron2/modeling/__init__.py", line 4, in <module>
from detectron2.layers import ShapeSpec
File "/home/xxx/tienpv_DO_NOT_REMOVE/detectron2_repo/detectron2/layers/__init__.py", line 3, in <module>
from .deform_conv import DeformConv, ModulatedDeformConv
File "/home/xxx/tienpv_DO_NOT_REMOVE/detectron2_repo/detectron2/layers/deform_conv.py", line 10, in <module>
from detectron2 import _C
ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory
>>>
When I run the following test, I also got the same error: ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory
python demo/demo.py --config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml \
--input input1.jpg input2.jpg \
[--other-options]
--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
The output of python -m detectron2.utils.collect_env.
sys.platform linux
Python 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0]
Numpy 1.18.0
detectron2._C failed to import
DETECTRON2_ENV_MODULE
PyTorch 1.3.1
PyTorch Debug Build False
torchvision 0.4.2
CUDA available True
GPU 0 GeForce GTX 1080 Ti
CUDA_HOME /usr/local/cuda
NVCC Cuda compilation tools, release 10.0, V10.0.130
Pillow 6.2.1
cv2 3.4.1
PyTorch built with:
I've tried many times to install with the instructions
https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md#common-installation-issues
but it doesn't work.
Please help me
Many thanks
Answered in https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md#common-installation-issues:
The version of NVCC you use to build detectron2 or torchvision does not match the version of CUDA you are running with. This often happens when using anaconda's CUDA runtime.
Use python -m detectron2.utils.collect_env to find out inconsistent CUDA versions. In the output of this command, you should expect "Detectron2 CUDA Compiler", "CUDA_HOME", "PyTorch built with - CUDA" to contain cuda libraries of the same version.
When they are inconsistent, you need to either install a different build of PyTorch (or build by yourself) to match your local CUDA installation, or install a different version of CUDA to match PyTorch.
@ppwwyyxx Now I have the similar error of
from detectron2 import _C
ImportError: libcudart.so.9.0: cannot open shared object file: No such file or directory
The env info is below,
and my cuda is "/usr/local/cuda -> /usr/local/cuda-10.0"
sys.platform linux
Python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56) [GCC 7.3.0]
numpy 1.19.1
detectron2 0.1.1 @/path/detectron2
detectron2._C failed to import
DETECTRON2_ENV_MODULE <not set>
PyTorch 1.4.0+cu100 @/data/anaconda3/envs/xxx/lib/python3.6/site-packages/torch
PyTorch debug build False
CUDA available True
GPU 0 Tesla P40
CUDA_HOME /usr/local/cuda
NVCC Cuda compilation tools, release 10.0, V10.0.130
Pillow 7.2.0
torchvision 0.5.0+cu100 @/data/anaconda3/envs/xxx/lib/python3.6/site-packages/torchvision
torchvision arch flags sm_35, sm_50, sm_60, sm_70, sm_75
cv2 4.4.0
---------------------- ------------------------------------------------------------------------------------------
PyTorch built with:
- GCC 7.3
- Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v0.21.1 (Git Hash 7d2fd500bc78936d1d648ca713b901012f470dbc)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- NNPACK is enabled
- CUDA Runtime 10.0
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
- CuDNN 7.6.3
- Magma 2.5.1
- Build settings: BLAS=MKL, BUILD_NAMEDTENSOR=OFF, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Wno-stringop-overflow, DISABLE_NUMA=1, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,
It seems to be alright. Can you help to find out the inconsistency ? Thanks !
Most helpful comment
Answered in https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md#common-installation-issues:
The version of NVCC you use to build detectron2 or torchvision does not match the version of CUDA you are running with. This often happens when using anaconda's CUDA runtime.
Use python -m detectron2.utils.collect_env to find out inconsistent CUDA versions. In the output of this command, you should expect "Detectron2 CUDA Compiler", "CUDA_HOME", "PyTorch built with - CUDA" to contain cuda libraries of the same version.
When they are inconsistent, you need to either install a different build of PyTorch (or build by yourself) to match your local CUDA installation, or install a different version of CUDA to match PyTorch.