pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
20.97k stars 3.62k forks source link

Code fail with torch_sparse/storage.py Error #9538

Open benmhamed-a opened 1 month ago

benmhamed-a commented 1 month ago

🐛 Describe the bug

I am trying to run my code that uses torch-spase. But it keeps failing with the following error: ` RuntimeError: attribute lookup is not defined on python value of type 'type': File "/srv/lustre01/project/pt_cloud-muhqxqc6fxo/users/abdelouahed.benmhame/AAAI2024/ICLR2025/lib/python3.8/site-packages/torch_sparse/utils.py", line 21 if not torch_sparse.typing.WITH_INDEX_SORT: # pragma: no cover return inputs.sort() return pyg_lib.ops.index_sort(inputs, max_value)


'index_sort' is being compiled since it was called from 'SparseStorage.__init__'
  File "/srv/lustre01/project/pt_cloud-muhqxqc6fxo/users/abdelouahed.benmhame/AAAI2024/ICLR2025/lib/python3.8/site-packages/torch_sparse/storage.py", line 156
            if (idx[1:] < idx[:-1]).any():
                max_value = self._sparse_sizes[0] * self._sparse_sizes[1]
                _, perm = index_sort(idx[1:], max_value)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
                self._row = self.row()[perm]
                self._col = self._col[perm]
`
I am runing my code on HPC with the following environment:
Python 3.8.5
Cython==0.29.23
numpy==1.24.4
scipy==1.10.1
torch==1.7.1+cu101
torch-cluster==1.5.9
torch-scatter==2.0.6
torch-sparse==0.6.18
torch_geometric==2.0.2
torchvision==0.8.2+cu101

I have tried loading the following version of GCC:
GCCcore/10.3.0
GCCcore/12.3.0
GCCcore-11.3.0

### Versions

Versions of relevant libraries:
[pip3] numpy==1.24.4
[pip3] torch==1.7.1+cu101
[pip3] torch-cluster==1.5.9
[pip3] torch_geometric==2.0.2
[pip3] torch-scatter==2.0.6
[pip3] torch-sparse==0.6.18
[pip3] torchvision==0.8.2+cu101
[conda] blas                      1.0                         mkl  
[conda] mkl                       2020.2                      256  
[conda] mkl-service               2.3.0            py38he904b0f_0  
[conda] mkl_fft                   1.2.0            py38h23d657b_0  
[conda] mkl_random                1.1.1            py38h0573a6f_0  
[conda] numpy                     1.19.2           py38h54aff64_0  
[conda] numpy-base                1.19.2           py38hfa32c7d_0  
[conda] numpydoc                  1.1.0              pyhd3eb1b0_1  
akihironitta commented 1 month ago

Looks like packages in your env are a few years old. Mind running it with the latest release?

benmhamed-a commented 1 month ago

I am actually obliged to use these old versions to run an old code.

akihironitta commented 1 month ago

If so, there's nothing we can do to fix this error if it's caused by a bug in the package.

benmhamed-a commented 1 month ago

What is weird is that it's a code from a paper and they provide this environment, but still can't fix this error:

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=conda_forge
_openmp_mutex=4.5=1_gnu
argon2-cffi=20.1.0=py38h497a2fe_2
ase=3.21.1=pypi_0
async_generator=1.10=py_0
atk-1.0=2.36.0=h3371d22_4
attrs=20.3.0=pypi_0
backcall=0.2.0=pyh9f0ad1d_0
backports=1.0=py_2
backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
bleach=3.3.0=pyh44b312d_0
ca-certificates=2020.12.5=ha878542_0
cairo=1.16.0=h6cf1ce9_1008
certifi=2020.12.5=py38h578d9bd_1
cffi=1.14.5=py38ha65f79e_0
chardet=4.0.0=pypi_0
click=8.0.1=pypi_0
cycler=0.10.0=py_2
cython=0.29.23=pypi_0
decorator=4.4.2=pypi_0
defusedxml=0.7.1=pyhd8ed1ab_0
entrypoints=0.3=pyhd8ed1ab_1003
expat=2.4.1=h9c3ff4c_0
filelock=3.0.12=pypi_0
font-ttf-dejavu-sans-mono=2.37=hab24e00_0
font-ttf-inconsolata=3.000=h77eed37_0
font-ttf-source-code-pro=2.038=h77eed37_0
font-ttf-ubuntu=0.83=hab24e00_0
fontconfig=2.13.1=hba837de_1005
fonts-conda-ecosystem=1=0
fonts-conda-forge=1=0
freetype=2.10.4=h0708190_1
fribidi=1.0.10=h36c2ea0_0
gdk-pixbuf=2.42.6=h04a7f16_0
gettext=0.19.8.1=h0b5b191_1005
giflib=5.2.1=h36c2ea0_2
googledrivedownloader=0.4=pypi_0
graphite2=1.3.13=h58526e2_1001
graphviz=2.47.1=h85b4f2f_1
gtk2=2.24.33=h539f30e_1
gts=0.7.6=h64030ff_2
h5py=3.2.1=pypi_0
harfbuzz=2.8.1=h83ec7ef_0
huggingface-hub=0.0.12=pypi_0
icu=68.1=h58526e2_0
idna=2.10=pypi_0
importlib-metadata=4.0.1=py38h578d9bd_0
iniconfig=1.1.1=pypi_0
ipykernel=5.5.5=py38hd0cf306_0
ipython=7.23.1=py38hd0cf306_0
ipython_genutils=0.2.0=py_1
isodate=0.6.0=pypi_0
jbig=2.1=h7f98852_2003
jedi=0.18.0=py38h578d9bd_2
jinja2=2.11.3=pypi_0
joblib=1.0.1=pypi_0
jpeg=9d=h36c2ea0_0
jsonschema=3.2.0=pyhd8ed1ab_3
jupyter_client=6.1.12=pyhd8ed1ab_0
jupyter_core=4.7.1=py38h578d9bd_0
jupyterlab_pygments=0.1.2=pyh9f0ad1d_0
kiwisolver=1.3.1=py38h1fd1430_1
lcms2=2.12=hddcbb42_0
ld_impl_linux-64=2.35.1=hea4e1c9_2
lerc=2.2.1=h9c3ff4c_0
libblas=3.9.0=9_openblas
libcblas=3.9.0=9_openblas
libdeflate=1.7=h7f98852_5
libffi=3.3=h58526e2_2
libgcc=7.2.0=h69d50b8_2
libgcc-ng=9.3.0=h2828fa1_19
libgd=2.3.2=h78a0170_0
libgfortran-ng=9.3.0=hff62375_19
libgfortran5=9.3.0=hff62375_19
libglib=2.68.2=h3e27bee_0
libgomp=9.3.0=h2828fa1_19
libiconv=1.16=h516909a_0
liblapack=3.9.0=9_openblas
libopenblas=0.3.15=pthreads_h8fe5266_1
libpng=1.6.37=h21135ba_2
librsvg=2.50.5=hc3c00ef_0
libsodium=1.0.18=h36c2ea0_1
libstdcxx-ng=9.3.0=h6de172a_19
libtiff=4.3.0=hf544144_1
libtool=2.4.6=h58526e2_1007
libuuid=2.32.1=h7f98852_1000
libwebp=1.2.0=h3452ae3_0
libwebp-base=1.2.0=h7f98852_2
libxcb=1.13=h7f98852_1003
libxml2=2.9.12=h72842e0_0
llvmlite=0.36.0=pypi_0
lz4-c=1.9.3=h9c3ff4c_0
markupsafe=1.1.1=pypi_0
matplotlib=3.4.1=pypi_0
matplotlib-base=3.4.2=py38hcc49a3a_0
matplotlib-inline=0.1.2=pyhd8ed1ab_2
mistune=0.8.4=py38h497a2fe_1003
nbclient=0.5.3=pyhd8ed1ab_0
nbconvert=6.0.7=py38h578d9bd_3
nbformat=5.1.3=pyhd8ed1ab_0
ncurses=6.2=h58526e2_4
nest-asyncio=1.5.1=pyhd8ed1ab_0
networkx=2.5.1=pypi_0
notebook=6.4.0=pyha770c72_0
numba=0.53.1=pypi_0
numpy=1.20.2=pypi_0
olefile=0.46=pyh9f0ad1d_1
openjpeg=2.4.0=hb52868f_1
openssl=1.1.1k=h7f98852_0
packaging=20.9=pyh44b312d_0
pandas=1.2.4=pypi_0
pandoc=2.13=h7f98852_0
pandocfilters=1.4.2=py_1
pango=1.48.5=hb8ff022_0
parso=0.8.2=pyhd8ed1ab_0
patsy=0.5.1=py_0
pcre=8.44=he1b5a44_0
pexpect=4.8.0=pyh9f0ad1d_2
pickleshare=0.7.5=py_1003
pillow=8.2.0=py38ha0e1e83_1
pip=21.0.1=pyhd8ed1ab_0
pixman=0.40.0=h36c2ea0_0
pluggy=0.13.1=pypi_0
prometheus_client=0.10.1=pyhd8ed1ab_0
prompt-toolkit=3.0.18=pyha770c72_0
pthread-stubs=0.4=h36c2ea0_1001
ptyprocess=0.7.0=pyhd3deb0d_0
py=1.10.0=pypi_0
pycparser=2.20=pyh9f0ad1d_2
pydot=1.4.2=py38h578d9bd_0
pygments=2.9.0=pyhd8ed1ab_0
pynndescent=0.5.2=pypi_0
pyparsing=2.4.7=pyh9f0ad1d_0
pyrsistent=0.17.3=py38h497a2fe_2
pyscipopt=1.4.9=pypi_0
pytest=6.2.3=pypi_0
python=3.8.8=hffdb5ce_0_cpython
python-dateutil=2.8.1=py_0
python-louvain=0.15=pypi_0
python_abi=3.8=1_cp38
pytz=2021.1=pyhd8ed1ab_0
pyyaml=5.4.1=pypi_0
pyzmq=22.0.3=py38h2035c66_1
rdflib=5.0.0=pypi_0
readline=8.0=he28a2e2_2
regex=2021.8.3=pypi_0
requests=2.25.1=pypi_0
sacremoses=0.0.45=pypi_0
scikit-learn=0.22=pypi_0
scipy=1.6.2=pypi_0
seaborn=0.11.1=hd8ed1ab_1
seaborn-base=0.11.1=pyhd8ed1ab_1
send2trash=1.5.0=py_0
setuptools=49.6.0=py38h578d9bd_3
six=1.15.0=pypi_0
sqlite=3.35.4=h74cdb3f_0
statsmodels=0.12.2=py38h5c078b8_0
terminado=0.10.0=py38h578d9bd_0
testpath=0.5.0=pyhd8ed1ab_0
threadpoolctl=2.1.0=pypi_0
tk=8.6.10=h21135ba_1
tokenizers=0.10.3=pypi_0
toml=0.10.2=pypi_0
torch=1.7.1+cu101=pypi_0
torch-cluster=1.5.9=pypi_0
torch-geometric=2.0.2=pypi_0
torch-scatter=2.0.6=pypi_0
torch-sparse=0.6.9=pypi_0
torch-spline-conv=1.2.1=pypi_0
torchaudio=0.7.2=pypi_0
torchvision=0.8.2+cu101=pypi_0
tornado=6.1=py38h497a2fe_1
tqdm=4.60.0=pypi_0
traitlets=5.0.5=py_0
transformers=4.9.2=pypi_0
typing-extensions=3.7.4.3=pypi_0
umap-learn=0.5.1=pypi_0
urllib3=1.26.4=pypi_0
wcwidth=0.2.5=pyh9f0ad1d_2
webencodings=0.5.1=py_1
wheel=0.36.2=pyhd3deb0d_0
xorg-kbproto=1.0.7=h7f98852_1002
xorg-libice=1.0.10=h7f98852_0
xorg-libsm=1.2.3=hd9c2040_1000
xorg-libx11=1.7.1=h7f98852_0
xorg-libxau=1.0.9=h7f98852_0
xorg-libxdmcp=1.1.3=h7f98852_0
xorg-libxext=1.3.4=h7f98852_1
xorg-libxrender=0.9.10=h7f98852_1003
xorg-renderproto=0.11.1=h7f98852_1002
xorg-xextproto=7.3.0=h7f98852_1002
xorg-xproto=7.0.31=h7f98852_1007
xz=5.2.5=h516909a_1
yacs=0.1.8=pypi_0
yaml=0.2.5=h516909a_0
zeromq=4.3.4=h9c3ff4c_0
zipp=3.4.1=pyhd8ed1ab_0
zlib=1.2.11=h516909a_1010
zstd=1.5.0=ha95c52a_0
akihironitta commented 1 month ago

I'd suggest contacting them (or sharing the full error message and the minimal code to reproduce it here if you'd like any help from PyG side).