How to install torch-scatter?

using below link to install torch-scatter for torch version : ‘2.2.0.dev20230928+cu121’

pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121 

After installing torch_scatter, and importing torch_scatter, I am getting this error:


OSError: /home/.../anaconda3/envs/..../lib/python3.11/site-packages/torch_scatter/_scatter_cpu.so: undefined symbol: _ZN5torch8autograd13_wrap_outputsERKSt6vectorIN2at6TensorESaIS3_EERKSt13unordered_setIPN3c1010TensorImplESt4hashISB_ESt8equal_toISB_ESaISB_EESJ_NS9_8ArrayRefINS9_8optionalIS3_EEEERKSt10shared_ptrINS0_4NodeEESt8functionIFS5_S5_S5_EESJ_

It was working fine previously. My cuda is 12.
Please guide @ptrblck. This is for others also.

I guess your torch-scatter installation might not be compatible with the latest PyTorch nightly, so either install a nightly scatter binary (if available) or build it from source.

1 Like

Sir could you please elaborate I am not sure how to proceed. Why this was working sometime before on same day, and now its not working.

Sir, I tried the link :
pip install torch-scatter==2.0.8 -f https://data.pyg.org/whl/torch-1.8.1+cu102.html

from
https://pytorch-geometric.com/whl/torch-1.8.1+cu102.html

Then the error is:

Traceback (most recent call last):

  Cell In[3], line 1
    import torch_scatter

  File ~/anaconda3/envs/Krishna/lib/python3.11/site-packages/torch_scatter/__init__.py:17
    raise AttributeError(e)

AttributeError: 'NoneType' object has no attribute 'origin'
In short, I want to install the correct version of torch_scatter for my torch version: '2.2.0.dev20230928+cu121'

You have installed a nightly PyTorch binary and would thus need to install a pytorch-scatter version which is compatible with such a new build. I don’t know if nightly binaries are available but if not you would need to build pytorch-scatter from source.

Sir @ptrblck please tell me which pytorch stable version should I download for my machine, with cuda 12, and compatible torch_scatter. Like If I download pytorch for cuda 11 will it work?
Regards

@sir I tried using CPU also, please guide what to do? If I can know which version of torch-scatter is compatible for CPU.

@ptrblck Sir I have cuda 12.0 which does not support torch stable version. So for the sake of programming I installed torch without cuda i.e. with CPU from here. But after successful installation of torch and torch geometric and torch scatter, I am still getting this error:

OSError: /home/anaconda3/envs/lib/python3.11/site-packages/torch_scatter/_scatter_cpu.so: undefined symbol: _ZN5torch8autograd13_wrap_outputsERKSt6vectorIN2at6TensorESaIS3_EERKSt13unordered_setIPN3c1010TensorImplESt4hashISB_ESt8equal_toISB_ESaISB_EESJ_NS9_8ArrayRefINS9_8optionalIS3_EEEERKSt10shared_ptrINS0_4NodeEERKSt8functionIFS5_S5_S5_EESJ_RKST_IFS3_S3_EE

Please guide what to do?

It does and the current stable as well as nightly binaries ship with CUDA 11.8 and 12.1 as seen here.

Sir I have tried, 11.8, But the torch scatter throwing some error that it is running without cuda. Are you saying that with Nvidia Cuda 12 I can use 11.8 and 12.1, will it support my cuda.
Also I am using same resource for downling which you pointed.