ModuleNotFoundError: No module named 'scatter_cuda'
See original GitHub issueHey
I am trying to use the package. I installed it via both pip and source. It works fine on the cpu but when I try to import scatter_cuda
on a gpu, it gives me the following error:
from torch_scatter import scatter_max
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/u/sodhanis/anaconda3/envs/torch4/lib/python3.6/site-packages/torch_scatter/__init__.py", line 3, in <module>
from .mul import scatter_mul
File "/u/sodhanis/anaconda3/envs/torch4/lib/python3.6/site-packages/torch_scatter/mul.py", line 3, in <module>
from torch_scatter.utils.ext import get_func
File "/u/sodhanis/anaconda3/envs/torch4/lib/python3.6/site-packages/torch_scatter/utils/ext.py", line 5, in <module>
import scatter_cuda
ModuleNotFoundError: No module named 'scatter_cuda'
I made sure to check te pytorch version ('0.4.1'
) and setup $PATH and $CPATH . For reference, they look like
$PATH=...anaconda3/envs/torch0.4.1/bin::/usr/local/cuda/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin
$CPATH=/usr/local/cuda/include
Edit:
Running python3 setup.py test
returns
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I/u/sodhanis/anaconda3/envs/torch4/lib/python3.6/site-packages/torch/lib/include -I/u/sodhanis/anaconda3/envs/torch4/lib/python3.6/site-packages/torch/lib/include/TH -I/u/sodhanis/anaconda3/envs/torch4/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/u/sodhanis/anaconda3/envs/torch4/include/python3.6m -c cuda/scatter_kernel.cu -o build/temp.linux-x86_64-3.6/cuda/scatter_kernel.o -DTORCH_EXTENSION_NAME=scatter_cuda -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options '-fPIC' -std=c++11
/u/sodhanis/anaconda3/envs/torch4/lib/python3.6/site-packages/torch/lib/include/ATen/Half-inl.h(17): error: identifier "__half_as_short" is undefined
1 error detected in the compilation of "/tmp/tmpxft_00001462_00000000-7_scatter_kernel.cpp1.ii".
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 2
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
No module named 'torch_scatter.scatter_cpu' · Issue ... - GitHub
Hi, I have a CUDA 9.0 env, and the installation was successful(pip install --verbose --no-cache-dir torch-scatter), but when I run python -c ...
Read more >ModuleNotFoundError: No module named 'en_core_web_sm'
5 Answers 5 · Go to command prompt · Run command: python -m spacy download en_core_web_sm.
Read more >No module named 'torch_scatter.scatter_cuda' - nlp
ModuleNotFoundError : No module named 'torch_scatter.scatter_cuda' cuda operating environment is 11.1 How can I fix it without lowering the ...
Read more >ModuleNotFoundError: No module named x
When it fails to do so, Python will throw ModuleNotFoundError for the first case or ImportError for the second case.
Read more >ModuleNotFoundError: no module named Python Error [Fixed]
When you try to import a module in a Python file, Python tries to resolve this module in several ways. Sometimes, Python throws...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Have the same problem when install from pip, build from source worked fine. I’m using cuda9.2 on ubuntu18.
I am not sure. I just followed your suggestion of
rm -rf build/ && python3 setup.py install
. I did not change my cuda version (since its a managed environment, I cant even if I want to) nor did I reinstall PyTorch. Also for the other modules likepytorch_sparse
etc, installing from source worked whilepip install
had issues.