pytorch_geometric: AttributeError: 'NoneType' object has no attribute 'origin'

📚 Installation

Traceback (most recent call last): File “/home/shelly/bourne/reimp_paper/MTAG-main/test/t1.py”, line 24, in <module> import torch_sparse File “/home/shelly/anaconda3/envs/pyt/lib/python3.6/site-packages/torch_sparse/init.py”, line 15, in <module> f’{library}_{suffix}', [osp.dirname(file)]).origin) AttributeError: ‘NoneType’ object has no attribute ‘origin’

Environment

Checklist

  • [1 ] I followed the installation guide.
  • [1 ] I cannot find my error message in the FAQ.
  • [1] I set up CUDA correctly and can compile CUDA code via nvcc.
  • [0 ] I do have multiple CUDA versions on my machine.

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I solved the problem by replacing pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.1+cu110.html with pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.0+cu110.html (My PyTorch version is 1.7.1)

I had the same problem and error statement. The problem in my situation was because I had multiple versions of the CUDA toolkit installed. I fixed this by setting the directory in PATH to point directly to the cuda-11.1 folder:

$ export PATH=/usr/local/cuda-11.1/bin:$PATH

And the same for CPATH and LD_LIBRARY_PATH:

$ export CPATH=/usr/local/cuda-11.1/include:$CPATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64:$LD_LIBRARY_PATH

Then, uninstall torch-sparse, and install with the --no-cache-dir flag, so it doesn’t use the cached wheel.

You are correct and I am wrong, and for that I apologize. Easybuild (the software we use to manage the installs of scientific software) needed some help to push those variables through.

I am sorry for the noise. With

export TORCH_CUDA_ARCH_LIST=$EASYBUILD_CUDA_COMPUTE_CAPABILITIES;
export WITH_METIS=1;
export FORCE_CUDA=1;
export CUDA_HOME=$EBROOTCUDA;
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH};
export PATH=${CUDA_HOME}/bin:${PATH};

It works.

By the way, whoever expects TORCH_CUDA_ARCH_LIST to be a semicolon-separated list deserves a full plate of rotten fish.