question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleNotFoundError: No module named 'scatter_cuda'

See original GitHub issue

Hey

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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zhangyuygsscommented, Oct 25, 2018

Have the same problem when install from pip, build from source worked fine. I’m using cuda9.2 on ubuntu18.

0reactions
shagunsodhanicommented, Oct 2, 2018

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 like pytorch_sparse etc, installing from source worked while pip install had issues.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found