Open
Description
When installing the openmm-torch plugin with the conda-forge packages, I met with the issue of ABI incompatibility:
Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:58:50)
[GCC 10.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 "${CONDA_PREFIX}/lib/python3.9/site-packages/openmmtorch.py", line 15, in <module>
import _openmmtorch
ImportError: ${CONDA_PREFIX}/lib/python3.9/site-packages/../../libOpenMMTorch.so: undefined symbol: _ZN5torch3jit4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN3c108optionalINS9_6DeviceEEE
For the tested setup pytorch v1.12, I checked the wheels from two sources: the official pip wheel and pytorch conda channel, inside which the pre-cxx11 name mangling was used:
$ readelf -sW libtorch_python.so | grep torch3jit4load
3501: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZN5torch3jit4loadERKSsN3c108optionalINS3_6DeviceEEE
33881: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZN5torch3jit4loadERKSsN3c108optionalINS3_6DeviceEEE
I don't know how you guys usually install pytorch, but in all my existing conda environments the pytorch uses pre-cxx11 name mangling. (Even though on pytorch's official website, libtorch
is offered in both ABI forms, the python wheels seem to have only pre-cxx11 symbol names.) For the convenience of non-power users, I would suggest either of the following changes:
- In
README.md
, show how the user should install a compatible version of pytorch, (for example, a recipe for setting up a new conda environment from scratch that works out-of-the-box). - Ship wheels/conda packages that is built against pre-cxx11 libtorch ABIs