from torch_sparse import coalesce
ImportError: No module named 'torch_sparse'
It seems that torch_sparse is not installed. How did you try to install it? Try to run
pip install --verbose --no-cache-dir torch-sparse
and see if there are any errors during installation.
I also use the exact command and I still get an error No module named 'torch_sparse'
I met the same error and I already have successfully run pip install --verbose --no-cache-dir torch-sparse.
What should I do next ?
This seems strange. As long as torch-sparse is listed in pip list, it should find the module. There can be only an installation error which prevents that or you may have different python installations, and you install it in to a different python location. In addition, you can alway try to install from source and see if this fixes the issue.
When I run pip install --verbose --no-cache-dir torch-sparse, the error occurs.
My gcc version of python is 7.3.0.
root@hh-ubuntu:/home/hh# python
Python 3.6.6 |Anaconda, Inc.| (default, Oct 9 2018, 12:34:16)
[GCC 7.3.0] on linux
root@hh-ubuntu:/home/hh# pip install --verbose --no-cache-dir torch-sparse
Created temporary directory: /tmp/pip-ephem-wheel-cache-1lc3vaps
Created temporary directory: /tmp/pip-req-tracker-sxiwp27z
Created requirements tracker '/tmp/pip-req-tracker-sxiwp27z'
Created temporary directory: /tmp/pip-install-v9mjfxtu
Collecting torch-sparse
1 location(s) to search for versions of torch-sparse:
definition of macro ‘AT_DISPATCH_FLOATING_TYPES’
const at::Type& the_type = TYPE;
^
error: command 'gcc' failed with exit status 1
You need to upgrade to PyTorch 1.1 :)
Now I have to use PyTorch 1.0.0 for my current work. Besides, I also want to use your pytorch_geometric to deal with works involving graph convolution. Do you have any idea to handle that incompatibility.
According to the releases, you can try to install torch-scatter==1.1.2 and repeat this process for the other packages. We rely on a lot of internal PyTorch APIs for our extension modules, which gets changed quite rapidly by the PyTorch team. Not much I can do about it. Sorry :(
After having the extension modules successfully installed, you can try to install PyTorch Geometric from source via python setup.py develop and comment out the includes that rely on newer extension functionalities.
Following your suggestion, I have successfully install the packages as follows:
torch-cluster 1.2.4
torch-geometric 1.2.1
torch-scatter 1.1.2
torch-sparse 0.2.3
torch-spline-conv 1.0.6
Thanks for your timely help.
root@hh-ubuntu:/home/hh# python
Python 3.6.6 |Anaconda, Inc.| (default, Oct 9 2018, 12:34:16)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import torch_scatter
import torch_sparse
import torch_cluster
import torch_geometric
pip install --verbose --no-cache-dir torch-sparse install error!!!!
ERROR: Command "'e:\anaconda\envs\pytorch\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\13224\AppData\Local\Temp\pip-install-wzr8089_\torch-sparse\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\13224\AppData\Local\Temp\pip-record-hxu3uth7\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\13224\AppData\Local\Temp\pip-install-wzr8089_torch-sparse\
Ran into this issue using pytorch 1.3 - had to clone and $ pip install . each package referenced in the installation guide.
@ddehueck Thank you. In my case, I have to reinstall CUDA and cuDNN. Then install all dependences from the source. Then it works.
Hello, I am trying to download the CoraFull dataset and apply/recreate the SplineCNN classifier. I am running into issues loading the data with the torch_sparse import. (I am in google collab), When I do the pip install verbose, I get an error saying that the Cuda Versions of Pytorch and Toche_Sparse are different (10.1 vs. 10 respectively). How can I rectify this as I don't think colab can go backwards in cuda versions?
@rusty1s
Install the packages with the currect CUDA version:
pip install torch-scatter==latest+cu101 torch-sparse==latest+cu101 -f https://s3.eu-central-1.amazonaws.com/pytorch-geometric.com/whl/torch-1.4.0.html
I am getting the same issue now, but I have cuda11
Do you have a local CUDA11 or are you using the PyTorch CUDA 11 package? You should be able to compile the libraries for CUDA 11 from source, and I'm currently working on providing CUDA 11 wheels.
To my surprise, Installation of this small library is real slow, showing Building wheel for torch-sparse (setup.py) ... | and I can not stop stopping building.
$ pip3.7 install torch_sparse
Collecting torch_sparse
Downloading torch_sparse-0.6.8.tar.gz (34 kB)
Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from torch_sparse) (1.4.1)
Requirement already satisfied: numpy>=1.13.3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from scipy->torch_sparse) (1.19.2)
Building wheels for collected packages: torch-sparse
Building wheel for torch-sparse (setup.py) ... /
Could you please create wheel files to provide fast installation?
There already exists wheel files for a smoother installation.
There already exists wheel files for a smoother installation.
Thank you very much.
Most helpful comment
Install the packages with the currect CUDA version: