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 #67

Closed
rafwiewiora opened this issue Feb 2, 2024 · 6 comments
Closed

Failure to import openmmtorch #67

rafwiewiora opened this issue Feb 2, 2024 · 6 comments

Comments

@rafwiewiora
Copy link

I'm stuck trying to make dependencies work, related to openmm/openmm-torch#127.

After standard mamba installation of openmm-ml I get:

File ~/miniforge3/envs/openmm-ml/lib/python3.11/site-packages/openmmml/models/anipotential.py:80, in ANIPotentialImpl.addForces(self, topology, system, atoms, forceGroup, filename, implementation, modelIndex, **args)
     78 import torchani
     79 import torch
---> 80 import openmmtorch
     82 # `nnpops` throws error if `periodic_table_index`=False if one passes `species` as `species_to_tensor` from `element`
     83 _kwarg_dict = {'periodic_table_index': True}

File ~/miniforge3/envs/openmm-ml/lib/python3.11/site-packages/openmmtorch.py:15
     13     from . import _openmmtorch
     14 else:
---> 15     import _openmmtorch
     17 try:
     18     import builtins as __builtin__

ImportError: libtorch_cuda.so: cannot open shared object file: No such file or directory

on trying to createSystem. I have the same problem with separately installing openmmtorch and this solution worked. But trying to install openmm-ml on top of that working openmmtorch (which requires using --no-deps) leads to the 'undefined symbol' error from torchani import, as seen here.

@peastman
Copy link
Member

peastman commented Feb 2, 2024

Can you post conda list for your environment? This probably means you have the CPU version of PyTorch installed.

We've been running into a lot of conda issues lately with PyTorch, CUDA, OpenMM, and other packages. See for example torchmd/torchmd-net#266 and conda-forge/openmm-torch-feedstock#48. I'm not sure what the cause is. @RaulPPelaez might have some insight.

@RaulPPelaez
Copy link
Contributor

I do not know what is going on these days. Seems like conda is falling apart -.-

Please provide the commands you ran from a clean environment and the result of conda-list so we can provide more help.

Be careful with settings like CONDA_CUDA_OVERRIDE, they are tricky and may cause unexpected inconsistencies.

For me, running something like this:

mamba create -n test openmm-torch "cuda-version>=12" openmm-ml

Tries to install the cpu versions of pytorch and some other packages, which is incorrect behavior. I also checked with conda and same behavior.
I have to specifically ask for pytorch cuda like this:

mamba create -n test openmm-torch openmm-ml pytorch=*=*cuda*

This results in an env in which I can import openmm-ml without issue.

There are these commented lines in the openmm-torch feedstock:

  #run_constrained:
    # 2022/02/05 hmaarrfk
    # While conda packaging seems to allow us to specify
    # constraints on the same package in different lines
    # the resulting package doesn't have the ability to
    # be specified in multiples lines
    # This makes it tricky to use run_exports
    # we add the GPU constraint in the run_constrained
    # to allow us to have "two" constraints on the
    # running package
    #- pytorch =*={{ torch_proc_type }}*

It really looks to me like that should be uncommented. Lets try...

@RaulPPelaez
Copy link
Contributor

Working on it here conda-forge/openmm-torch-feedstock#49

@rafwiewiora
Copy link
Author

Thank you both! mamba install openmm-torch openmm-ml pytorch=*=*cuda* indeed did the magic. For completeness, here's the conda list I get after mamba install openmm-ml -- it is the CPU version of pytorch problem:

# packages in environment at /home/rafal.wiewiora/miniforge3/envs/openmmmlbroken:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
brotli-python             1.1.0           py311hb755f60_1    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
c-ares                    1.26.0               hd590300_0    conda-forge
ca-certificates           2024.2.2             hbcca054_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
certifi                   2023.11.17         pyhd8ed1ab_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
cudatoolkit               11.8.0              h4ba93d1_13    conda-forge
filelock                  3.13.1             pyhd8ed1ab_0    conda-forge
fsspec                    2023.12.2          pyhca7485f_0    conda-forge
gmp                       6.3.0                h59595ed_0    conda-forge
gmpy2                     2.1.2           py311h6a5fa03_1    conda-forge
h5py                      3.10.0          nompi_py311hebc2b07_101    conda-forge
hdf5                      1.14.3          nompi_h4f84152_100    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
importlib-metadata        7.0.1              pyha770c72_0    conda-forge
importlib_metadata        7.0.1                hd8ed1ab_0    conda-forge
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
lark-parser               0.12.0             pyhd8ed1ab_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libabseil                 20230802.1      cxx17_h59595ed_0    conda-forge
libaec                    1.1.2                h59595ed_1    conda-forge
libblas                   3.9.0           21_linux64_openblas    conda-forge
libcblas                  3.9.0           21_linux64_openblas    conda-forge
libcurl                   8.5.0                hca28451_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libgfortran-ng            13.2.0               h69a702a_5    conda-forge
libgfortran5              13.2.0               ha4646dd_5    conda-forge
libgomp                   13.2.0               h807b86a_5    conda-forge
liblapack                 3.9.0           21_linux64_openblas    conda-forge
libnghttp2                1.58.0               h47da74e_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libopenblas               0.3.26          pthreads_h413a1c8_0    conda-forge
libprotobuf               4.25.1               hf27288f_0    conda-forge
libsqlite                 3.44.2               h2797004_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_5    conda-forge
libtorch                  2.1.2           cpu_generic_ha017de0_1    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libuv                     1.46.0               hd590300_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
markupsafe                2.1.4           py311h459d7ec_0    conda-forge
mpc                       1.3.1                hfe3b2da_0    conda-forge
mpfr                      4.2.1                h9458935_0    conda-forge
mpmath                    1.3.0              pyhd8ed1ab_0    conda-forge
ncurses                   6.4                  h59595ed_2    conda-forge
networkx                  3.2.1              pyhd8ed1ab_0    conda-forge
nomkl                     1.0                  h5ca1d4c_0    conda-forge
numpy                     1.26.3          py311h64a7726_0    conda-forge
ocl-icd                   2.3.1                h7f98852_0    conda-forge
ocl-icd-system            1.0.0                         1    conda-forge
openmm                    8.1.1           py311h9766050_0    conda-forge
openmm-ml                 1.1                pyhd8ed1ab_0    conda-forge
openmm-torch              1.4             cpu_py311h446247e_3    conda-forge
openssl                   3.2.1                hd590300_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pip                       23.3.2             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.7          hab00c5b_1_cpython    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pytorch                   2.1.2           cpu_generic_py311h1584bb0_1    conda-forge
readline                  8.2                  h8228510_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
scipy                     1.12.0          py311h64a7726_2    conda-forge
setuptools                65.3.0             pyhd8ed1ab_1    conda-forge
setuptools-scm            6.3.2              pyhd8ed1ab_0    conda-forge
setuptools_scm            6.3.2                hd8ed1ab_0    conda-forge
sleef                     3.5.1                h9b69904_2    conda-forge
sympy                     1.12            pypyh9d50eac_103    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
torchani                  2.2.4           cpu_py311h12a0d1d_3    conda-forge
typing_extensions         4.9.0              pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
urllib3                   2.2.0              pyhd8ed1ab_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zstd                      1.5.5                hfc55251_0    conda-forge

@peastman
Copy link
Member

peastman commented Feb 2, 2024

We have new packages for OpenMM and OpenMM-Torch. Hopefully they fix the problem. Can you try again and see?

@rafwiewiora
Copy link
Author

Confirmed, no problems now, thanks again!

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