question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error inference with single files and torch_geometric

See original GitHub issue

I installed this in a fresh environment using the provided environment.yml. but it fails on inference. I attached the two files (renamed to txt for upload)

The esm embedding step works:

(diffdock) $ HOME=esm/model_weights python esm/scripts/extract.py esm2_t33_650M_UR50D data/prepared_for_esm.fasta data/esm2_output --repr_layers 33 --include per_tok
Downloading: "https://dl.fbaipublicfiles.com/fair-esm/models/esm2_t33_650M_UR50D.pt" to esm/model_weights/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D.pt
Downloading: "https://dl.fbaipublicfiles.com/fair-esm/regression/esm2_t33_650M_UR50D-contact-regression.pt" to esm/model_weights/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D-contact-regression.pt
Transferred model to GPU
Read data/prepared_for_esm.fasta with 2 sequences
Processing 1 of 1 batches (2 sequences)

I get the following error when executing this command in the root dir of the project. I did not download the data and used single sdf and pdb files but according to the README that should work. data/esm2_output contains two .pt files: 1cbr_protein.pdb_chain_0.pt 1cbr_protein.pdb_chain_1.pt

(diffdock) $ python -m inference --ligand_path examples/1cbr_ligand.sdf --protein_path examples/1cbr_protein.pdb --out_dir results/user_predictions_small --inference_steps 20 --samples_per_complex 40 --batch_size 10
Traceback (most recent call last):
  File "/home/duerr/miniconda3/envs/diffdock/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/duerr/miniconda3/envs/diffdock/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/share/lcbcsrv5/lcbcdata/duerr/PhD/08_Code/DiffDock/inference.py", line 16, in <module>
    from datasets.pdbbind import PDBBind
  File "/share/lcbcsrv5/lcbcdata/duerr/PhD/08_Code/DiffDock/datasets/pdbbind.py", line 22, in <module>
    from utils.utils import read_strings_from_txt
  File "/share/lcbcsrv5/lcbcdata/duerr/PhD/08_Code/DiffDock/utils/utils.py", line 12, in <module>
    from torch_geometric.nn.data_parallel import DataParallel
  File "/home/duerr/miniconda3/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/__init__.py", line 3, in <module>
    from .sequential import Sequential
  File "/home/duerr/miniconda3/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/sequential.py", line 8, in <module>
    from torch_geometric.nn.conv.utils.jit import class_from_module_repr
  File "/home/duerr/miniconda3/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/conv/__init__.py", line 25, in <module>
    from .spline_conv import SplineConv
  File "/home/duerr/miniconda3/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/conv/spline_conv.py", line 16, in <module>
    from torch_spline_conv import spline_basis, spline_weighting
  File "/home/duerr/miniconda3/envs/diffdock/lib/python3.9/site-packages/torch_spline_conv/__init__.py", line 11, in <module>
    torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
AttributeError: 'NoneType' object has no attribute 'origin'

1cbr_ligand.txt 1cbr_protein.txt

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
duerrsimoncommented, Oct 5, 2022

Yes that is the offending line. I think you should make the environment file more bulletproof by separating the pip from the conda parts into different files and install the torch geometric version using -f https://data.pyg.org/whl/torch-1.12.0+cu113.html (or whatever cuda version is supported by the users platform) in requirements.txt. As it is now it will pull the cpu version of pytorch geometric and I think environment.yml does not support flags in the pip part so you need separate files.

If I execute pip install -U torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.12.0+cu113.html in the environment it does not update anything, if I pip uninstall the packages and reinstall them using this command from torch_geometric.nn.data_parallel import DataParallel works.

1reaction
mf-rugcommented, Oct 9, 2022

pip uninstall torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric pip install -U torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.12.0+cu113.html Pick the cuda version that matches your pytorch cuda version that you can find out using:

import torch
torch.version.cuda

Above commands are for cuda 11.3

Sweet thanks. If this happens to anyone else, for me the error originally only happened when running on gpu, but not on cpu. After

>>> torch.version.cuda
'11.3'

$ pip uninstall torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric
$ pip install -U torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.12.0+cu113.html

I got this new error on cpu:

Traceback (most recent call last):
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/data/p273962/DiffDock/inference.py", line 16, in <module>
    from datasets.pdbbind import PDBBind
  File "/data/p273962/DiffDock/datasets/pdbbind.py", line 22, in <module>
    from utils.utils import read_strings_from_txt
  File "/data/p273962/DiffDock/utils/utils.py", line 12, in <module>
    from torch_geometric.nn.data_parallel import DataParallel
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/__init__.py", line 3, in <module>
    from .sequential import Sequential
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/sequential.py", line 8, in <module>
    from torch_geometric.nn.conv.utils.jit import class_from_module_repr
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/conv/__init__.py", line 25, in <module>
    from .spline_conv import SplineConv
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/site-packages/torch_geometric/nn/conv/spline_conv.py", line 16, in <module>
    from torch_spline_conv import spline_basis, spline_weighting
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/site-packages/torch_spline_conv/__init__.py", line 15, in <module>
    torch.ops.load_library(spec.origin)
  File "/data/p273962/conda/envs/diffdock/lib/python3.9/site-packages/torch/_ops.py", line 255, in load_library
    ctypes.CDLL(path)
  File "/data/p273962/conda/envs/diffdock/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 /data/p273962/conda/envs/diffdock/lib/python3.9/site-packages/torch_spline_conv/_basis_cuda.so)

but I found this, and after doing

pip uninstall torch-spline-conv

it worked on cpu again. Seems like that package is not needed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

OSError: /lib64/libm.so.6: version `GLIBC_2.27' not found #3593
Installation I have followed the instructions on the pytorch geometric website, and am repeatedly getting this error.
Read more >
Issue with Pytorch geometric - Trainer
I am having an issue with a super simple PyG model when integrating it with Pytorch Lightning. ... As one can check, each...
Read more >
Installation — pytorch_geometric documentation
We collected a lot of common installation errors in the Frequently Asked ... file not recognized: file format not recognized : Clean the...
Read more >
Dlopen error in loading pytorch geometric - Stack Overflow
This seems to be a problem with the lib files of your present environment. I suggest activating into your environment.
Read more >
How to fix “CUDA error: device-side assert triggered” error?
I use huggingface Transformer to fine-tune a binary classification model. When I do inference job on big data. In rare case, it will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found