NVIDIA / MinkowskiEngine

Minkowski Engine is an auto-diff neural network library for high-dimensional sparse tensors
https://nvidia.github.io/MinkowskiEngine
Other
2.48k stars 367 forks source link

ImportError: Undefined symbol #353

Closed ptoews closed 3 years ago

ptoews commented 3 years ago

Describe the bug When importing ME, the following error is shown:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    import MinkowskiEngine as ME
  File "[...]/venv/lib/python3.8/site-packages/MinkowskiEngine/__init__.py", line 53, in <module>
    from MinkowskiEngineBackend._C import (
ImportError: [...]/venv/lib/python3.8/site-packages/MinkowskiEngineBackend/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN2at5emptyEN3c108ArrayRefIlEENS0_13TensorOptionsENS0_8optionalINS0_12MemoryFormatEEE

To Reproduce

import MinkowskiEngine as ME

Desktop (please complete the following information):

Perhaps I installed something wrongly. Is it a problem that pytorch and CUDA refer to different minor versions (11.0 and 11.3)?

chrischoy commented 3 years ago

Please paste the output of

wget -q https://raw.githubusercontent.com/NVIDIA/MinkowskiEngine/master/MinkowskiEngine/diagnostics.py ; python diagnostics.py
ptoews commented 3 years ago
==========System==========
Linux-5.8.0-50-generic-x86_64-with-glibc2.29
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
3.8.5 (default, Jan 27 2021, 15:41:15) 
[GCC 9.3.0]
==========Pytorch==========
1.7.1+cu110
torch.cuda.is_available(): True
==========NVIDIA-SMI==========
/usr/bin/nvidia-smi
Driver Version 465.19.01
CUDA Version 11.3
VBIOS Version 94.02.27.00.09
Image Version G001.0000.03.03
==========NVCC==========
/usr/bin/nvcc
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
==========CC==========
/usr/bin/c++
c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

==========MinkowskiEngine==========
[...]/venv/lib/python3.8/site-packages/MinkowskiEngine/__init__.py:36: UserWarning: The environment variable `OMP_NUM_THREADS` not set. MinkowskiEngine will automatically set `OMP_NUM_THREADS=16`. If you want to set `OMP_NUM_THREADS` manually, please export it on the command line before running a python script. e.g. `export OMP_NUM_THREADS=12; python your_program.py`. It is recommended to set it below 24.
  warnings.warn(
MinkowskiEngine not installed
chrischoy commented 3 years ago

You used nvcc 10.1 to compile MinkowskiEngine with pytorch1.7+cu11.1.

CUDA 10 and CUDA 11 are not compatible.

Please specify the NVCC path to the correct version by

export CUDA_HOME=/usr/local/cuda-11.3; python setup.py install
ptoews commented 3 years ago

I actually installed MinkowskiEngine using pip, and since I don't have CUDA 10 installed it came precompiled with 10 maybe? Anyway I compiled it myself this time with the path set as you said and now it works. Thanks!

chrischoy commented 3 years ago

CUDA is not shipped with MinkowskiEngine and MinkowskiEngine pip installation also is a wrapper for compilation.

nvidia-smi print CUDA version != nvcc version. NVCC version is what matters for compilation.

Glad it solved the problem.

Tcode8 commented 8 months ago

Hello could you please tell me how to solve the problem below?

ImportError: /home/ouc/anaconda3/envs/lmpr/lib/python3.6/site-packages/MinkowskiEngine-0.5.4-py3.6-linux-x86_64.egg/MinkowskiEngineBackend/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor4meanEN3c108ArrayRefIlEEbNS1_8optionalINS1_10ScalarTypeEEE

lbhwyy commented 8 months ago

I meet the same problem. Have you solve it?