Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to import openmmtorch #127

Closed
eva-not opened this issue Dec 15, 2023 · 3 comments
Closed

Failure to import openmmtorch #127

eva-not opened this issue Dec 15, 2023 · 3 comments

Comments

@eva-not
Copy link

eva-not commented Dec 15, 2023

I'm trying to install openmm-torch in a fresh conda environment (Ubuntu 20.04 LTS with CUDA 12.0). When I use the default installation command
conda install -c conda-forge openmm-torch
and try to import openmmtorch, I get the following error:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/eva/anaconda3/envs/openmm-torch/lib/python3.11/site-packages/openmmtorch.py", line 15, in <module> import _openmmtorch ImportError: libtorch_cuda.so: cannot open shared object file: No such file or directory

From the output of conda list, I can see that the installed pytorch is the CPU version cpu_generic_py311h495eaba_0, which probably explains the incompatibility.

If I install openmm-torch and pytorch simultaneously with
mamba install pytorch torchvision torchaudio pytorch-cuda=11.8 openmm-torch -c pytorch -c nvidia -c conda-forge
and try to import openmmtorch, I get this other error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/eva/anaconda3/envs/openmm-torch/lib/python3.10/site-packages/openmmtorch.py", line 15, in <module> import _openmmtorch ImportError: /home/eva/anaconda3/envs/openmm-torch/lib/python3.10/site-packages/../../libOpenMMTorch.so: undefined symbol: _ZN5torch3jit4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN3c108optionalINS9_6DeviceEEEb

Is there a way to overcome this? Any help would be greatly appreciated!

@peastman
Copy link
Member

You need to remove the extra channels-c pytorch -c nvidia. The builds of PyTorch from the different channels aren't compatible with each other.

@sef43
Copy link

sef43 commented Dec 17, 2023

Hi @eva-not

The first import error sounds like #94

Can you try setting:
export CONDA_OVERRIDE_CUDA=12.0
before installing the package from conda-forge

@eva-not
Copy link
Author

eva-not commented Dec 17, 2023

Thank you both! I managed to install it with:
conda install pytorch=2=*cuda* -c conda-forge
conda install openmm-torch -c conda-forge

and importing works fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants