chao1224 / MoleculeSTM

Multi-modal Molecule Structure-text Model for Text-based Editing and Retrieval, Nat Mach Intell 2023 (https://www.nature.com/articles/s42256-023-00759-6)
https://chao1224.github.io/MoleculeSTM
Other
188 stars 18 forks source link

OSError: _ZN5torch3jit17parseSchemaOrNameERKSs #14

Closed Msornerrrr closed 6 months ago

Msornerrrr commented 6 months ago

Hello, I have installed all required packages following the README When I run any script in section 4, I got this error which seems indicates a compatibility issue between the installed versions of PyTorch and the torch-sparse package.

Run:

python pretrain.py \
    --verbose --batch_size=8 \
    --molecule_type=Graph

Error:

Traceback (most recent call last):
  File "pretrain.py", line 13, in <module>
    from torch_geometric.loader import DataLoader as pyg_DataLoader
  File "/home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/site-packages/torch_geometric/__init__.py", line 4, in <module>
    import torch_geometric.data
  File "/home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/site-packages/torch_geometric/data/__init__.py", line 1, in <module>
    from .data import Data
  File "/home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/site-packages/torch_geometric/data/data.py", line 3, in <module>
    from torch_geometric.typing import OptTensor, NodeType, EdgeType
  File "/home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/site-packages/torch_geometric/typing.py", line 4, in <module>
    from torch_sparse import SparseTensor
  File "/home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/site-packages/torch_sparse/__init__.py", line 16, in <module>
    f'{library}_{suffix}', [osp.dirname(__file__)]).origin)
  File "/home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/site-packages/torch/_ops.py", line 104, in load_library
    ctypes.CDLL(path)
  File "/home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/ctypes/__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/username/miniconda3/envs/MoleculeSTM/lib/python3.7/site-packages/torch_sparse/_version_cpu.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

I also found some useful info for this issue: https://github.com/pyg-team/pytorch_geometric/issues/999 https://github.com/pyg-team/pytorch_geometric/issues/3836

chao1224 commented 6 months ago

Hi @Msornerrrr, what are the versions of pyg and relevant packages (e.g., torch_sparse)?

Msornerrrr commented 6 months ago

Hi, I'm using the following command to download pyg and relevant packages and the bug seems to be specific to the earlier version of pyg

conda install -y -c conda-forge -c pytorch pytorch=1.9.1
conda install -y -c pyg -c conda-forge pyg==2.0.3

I end up instead using the current version of pyg from the official docs: https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html, and the following commands seems to fix this issue

pip install torch
pip install torch_geometric
VERSION=$(python -c "import torch; print(torch.__version__)")
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-$VERSION.html