openmm / openmm-torch

OpenMM plugin to define forces with neural networks
180 stars 23 forks source link

conda-forge builds do not install properly on linux without CUDA #94

Open sef43 opened 1 year ago

sef43 commented 1 year ago

I am using a linux machine which does not have CUDA and does not have NVIDIA GPUS. When I install the latest version of opemm-torch and openmm using this command:

mamba install -c conda-forge -c "conda-forge/label/openmm-torch_rc" -c "conda-forge/label/openmm_rc" openmm=8 openmm-torch=1

I get errors when importing openmmtorch:

python
Python 3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:27:40) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openmmtorch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/export/users/sfarr/miniconda3/envs/test_rc/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

I think this is because conda installs these incompatible packages:

openmm-torch              1.0rc1          cuda112py311h756f8fe_0    conda-forge/label/openmm-torch_rc
pytorch                   1.13.1          cpu_py311h410fd25_0    conda-forge

openmm-torch uses a pytorch cuda version, but the pytorch installed is a cpu only version.

raimis commented 1 year ago

You can override the CUDA detection: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-virtual.html#overriding-detected-packages

sef43 commented 1 year ago

Should we put this workaround on the README install guide?

peastman commented 1 year ago

Users shouldn't need a workaround. It ought to automatically install compatible packages.

sef43 commented 1 year ago

As I understand it that would require us providing a conda-forge build of openmm-torch that is built against, and depends on, conda-forge pytorch-*-cpu. The pytorch-*-gpu versions on conda-forge have a dependency on __cuda so can only be installed by conda if the user has a CUDA installation or overrides the CUDA detection.

sef43 commented 11 months ago

This is still a problem with the 1.4 release. It is the same as the issues on the feedstock: https://github.com/conda-forge/openmm-torch-feedstock/issues/37