Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: /home/xxx/detectron2/detectron2/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cudaSetupArgument #567

Closed
dydxdt opened this issue Dec 23, 2019 · 2 comments

Comments

@dydxdt
Copy link

dydxdt commented Dec 23, 2019

##Instructions To Reproduce the Issue

  1. Do the same as in INSTALL.md
git clone https://github.com/facebookresearch/detectron2.git
cd detectron2
python setup.py build develop
  1. run the command according to Colab(get input.jpg) and GETTING_STARTED.md :
    wget http://images.cocodataset.org/val2017/000000439715.jpg -O input.jpg

python demo/demo.py --config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml
--input input.jpg
--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl

  1. get the error:
Traceback (most recent call last):
  File "demo/demo.py", line 11, in <module>
    from detectron2.data.detection_utils import read_image
  File "/home/dengyue/detectron2/detectron2/data/__init__.py", line 4, in <module>
    from .build import (
  File "/home/dengyue/detectron2/detectron2/data/build.py", line 14, in <module>
    from detectron2.structures import BoxMode
  File "/home/dengyue/detectron2/detectron2/structures/__init__.py", line 2, in <module>
    from .boxes import Boxes, BoxMode, pairwise_iou
  File "/home/dengyue/detectron2/detectron2/structures/boxes.py", line 8, in <module>
    from detectron2.layers import cat
  File "/home/dengyue/detectron2/detectron2/layers/__init__.py", line 3, in <module>
    from .deform_conv import DeformConv, ModulatedDeformConv
  File "/home/dengyue/detectron2/detectron2/layers/deform_conv.py", line 10, in <module>
    from detectron2 import _C
ImportError: /home/dengyue/detectron2/detectron2/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cudaSetupArgument

Environment

the output of python -m detectron2.utils.collect_env,


sys.platform linux
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) [GCC 7.3.0]
Numpy 1.17.4
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,1,2,3 Quadro P5000
CUDA_HOME /usr/local/cuda-9.0
NVCC Cuda compilation tools, release 9.0, V9.0.176
Pillow 6.2.1
cv2 4.1.2


PyTorch built with:

  • GCC 7.3
  • Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v0.20.5 (Git Hash 0125f28c61c1f822fd48570b4c1066f96fcb9b2e)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CUDA Runtime 10.1
  • 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=True, 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,

I just searched the solutions and it may be the CUDA version problem. I installed Pytorch with cuda 10.1. And print 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.176
"
Can anyone tell me how to solve the problem?Thank you very much.

@ppwwyyxx
Copy link
Contributor

Your nvcc and pytorch's cuda has different versions.
How to fix it is unrelated to detectron2.

@escorciav
Copy link

escorciav commented Feb 7, 2020

Watch out for the way the CUDA_HOME is set in pytorch/utils/cpp_extension.py.

Issue: I use pytorch-1.3-py3.6 from conda-c:pytorch, but have a local version of CUDA in usr/local/cuda. For whatever reason, PyTorch set the CUDA_HOME to that path as opposed to None creating the symbol miss-match.

Tested hack: Edit pytorch/utils/cpp_extension.py by changing the hard-coded guess. No problems for building and using detectron2, as part of slowfast.

Make sure that you delete the build and *.egg folder from the detectron2 folder. If you created them as part of the installation procedure.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants