pytorch_geometric: Cannot import torch-spline-conv when installed from pip wheel in Torch 1.9.0 and CUDA 11.1

πŸ“š Installation

I had been able install all pytorch-geometric related packages via pip prior to the new 1.7.1 release and it all works well. However, with the new release, pip install seems to skip β€œbuilding the wheel” for torch-spline-conv, but still give a successful installation. When importing the torch-spline-conv, it then gives this error:

β€”> 46 from torch_geometric.nn import MetaPath2Vec

/opt/anaconda3/lib/python3.7/site-packages/torch_geometric/nn/init.py in <module> 3 from .data_parallel import DataParallel 4 from .reshape import Reshape ----> 5 from .conv import * # noqa 6 from .norm import * # noqa 7 from .glob import * # noqa

/opt/anaconda3/lib/python3.7/site-packages/torch_geometric/nn/conv/init.py in <module> 22 from .point_conv import PointConv 23 from .gmm_conv import GMMConv β€”> 24 from .spline_conv import SplineConv 25 from .nn_conv import NNConv, ECConv 26 from .cg_conv import CGConv

/opt/anaconda3/lib/python3.7/site-packages/torch_geometric/nn/conv/spline_conv.py in <module> 12 13 try: β€”> 14 from torch_spline_conv import spline_basis, spline_weighting 15 except ImportError: 16 spline_basis = None

/opt/anaconda3/lib/python3.7/site-packages/torch_spline_conv/init.py in <module> 10 for library in [β€˜_version’, β€˜_basis’, β€˜weighting’]: 11 torch.ops.load_library(importlib.machinery.PathFinder().find_spec( β€”> 12 f’{library}{suffix}’, [osp.dirname(file)]).origin) 13 14 if torch.cuda.is_available(): # pragma: no cover

/opt/anaconda3/lib/python3.7/site-packages/torch/_ops.py in load_library(self, path) 102 # static (global) initialization code in order to register custom 103 # operators with the JIT. –> 104 ctypes.CDLL(path) 105 self.loaded_libraries.add(path) 106

/opt/anaconda3/lib/python3.7/ctypes/init.py in init(self, name, mode, handle, use_errno, use_last_error) 362 363 if handle is None: –> 364 self._handle = _dlopen(self._name, mode) 365 else: 366 self._handle = handle

OSError: /lib64/libm.so.6: version `GLIBC_2.27’ not found (required by /opt/anaconda3/lib/python3.7/site-packages/torch_spline_conv/_basis_cuda.so)

Environment

  • OS: Centos 7
  • Python version: 3.7
  • PyTorch version: 1.9
  • CUDA/cuDNN version: 11.1
  • GCC version: 6.3.0
  • How did you try to install PyTorch Geometric and its extensions (wheel, source): wheel
  • Any other relevant information:

CUDA=β€œcu111” pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.9.0+${CUDA}.html pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.9.0+${CUDA}.html pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.9.0+${CUDA}.html pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.9.0+${CUDA}.html

Checklist

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

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

FYI, it seems that this issue persists with torch 1.11.0, however uninstalling torch-spline-conv solves the problem.

I’d like to reopen this issue since building from source doesn’t fix the underlying problem of the wheels. It doesn’t seem to be a CUDA version specific issue, since I’ve experienced the same with CUDA 10.2. Moreover, I’ve tested it with several python versions, from 3.7 to 3.9, but without success.

Reproducibility

Pytorch and dependencies installed with conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

torch-spline-conv installed with:

❯ pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html

Looking in links: https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html
Collecting torch-spline-conv
  Downloading https://pytorch-geometric.com/whl/torch-1.9.0%2Bcu102/torch_spline_conv-1.2.1-cp39-cp39-linux_x86_64.whl (368 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 368 kB 29.4 MB/s 
Installing collected packages: torch-spline-conv
Successfully installed torch-spline-conv-1.2.1

Python output

❯ python
Python 3.9.5 | packaged by conda-forge | (default, Jun 19 2021, 00:32:32) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch_spline_conv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "envs/test39/lib/python3.9/site-packages/torch_spline_conv/__init__.py", line 11, in <module>
    torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
  File "envs/test39/lib/python3.9/site-packages/torch/_ops.py", line 104, in load_library
    ctypes.CDLL(path)
  File "envs/test39/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by envs/test39/lib/python3.9/site-packages/torch_spline_conv/_basis_cuda.so)

The bug only shows up in a CUDA capable machine. Importing the module on a machine without CUDA support works fine. I’ll be happy to report additional details as well as submit this issue on the official torch-spline-conv repository.

Ok, I’m trying to track this issue down, but it’s unclear to me why imports of other packages work fine, while it fails for torch-spline-conv. Do you need SplineConv in your work? Other-wise feel free to uninstall it as it is an optional dependency by now.

Other-wise, you can try multiple options:

You should also check what version of glibc you have on your CentOS 7 machine.