openmm / openmm-plumed

OpenMM plugin to interface with PLUMED
55 stars 23 forks source link

more import errors #2

Closed msultan closed 3 years ago

msultan commented 7 years ago

Hey Peter, So i am running into a newer error on another cluster when I try and install the plugin there. I already have OpenMM 7.0.1 installed along with plumed. I also tried doing fresh builds but it sems to install just fine and then gives the following error.

 plumed --is-installed
[msultan@gpu-27-21 ~/software/openmm-plumed/temp6]$ python -m simtk.testInstallation
There are 4 Platforms available:

1 Reference - Successfully computed forces
2 CPU - Successfully computed forces
3 CUDA - Successfully computed forces
4 OpenCL - Successfully computed forces

Median difference in forces between platforms:

Reference vs. CPU: 1.97903e-05
Reference vs. CUDA: 2.15426e-05
CPU vs. CUDA: 1.55626e-05
Reference vs. OpenCL: 2.15122e-05
CPU vs. OpenCL: 1.55626e-05
CUDA vs. OpenCL: 1.47779e-07
[msultan@gpu-27-21 ~/software/openmm-plumed/temp6]$ which python
~/software/anaconda/bin/python
[msultan@gpu-27-21 ~/software/openmm-plumed/temp6]$ which ipython
~/software/anaconda/bin/ipython
[msultan@gpu-27-21 ~/software/openmm-plumed/temp6]$ python -m openmmplumed
Traceback (most recent call last):
  File "/home/msultan/software/anaconda/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/msultan/software/anaconda/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/msultan/software/anaconda/lib/python3.5/site-packages/openmmplumed.py", line 28, in <module>
    _openmmplumed = swig_import_helper()
  File "/home/msultan/software/anaconda/lib/python3.5/site-packages/openmmplumed.py", line 24, in swig_import_helper
    _mod = imp.load_module('_openmmplumed', fp, pathname, description)
  File "/home/msultan/software/anaconda/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/msultan/software/anaconda/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: /home/msultan/software/anaconda/lib/python3.5/site-packages/_openmmplumed.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev

Thanks for all the help!

msultan commented 7 years ago
ipython
fPython 3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul  2 2016, 17:53:06) 
Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from simtk.openmm import version

In [2]: version.full_version
Out[2]: '7.0.1.dev-5e86c4f'
yuebinzhang commented 7 years ago

adds openmm-7.0.1/lib into LD_LIBRARY_PATH such as export LD_LIBRARY_PATH=/[somewhere your openmm installed]/openmm-7.0.1/lib:$LD_LIBRARY_PATH

solves the problem

shafferpr commented 6 years ago

I get the same error above and modifying LD_LIBRARY_PATH does not fix it (I included both the openmm libs and the plumed libs). Has anyone else had success in resolving this issue?

Zhou-Yang commented 6 years ago

I get a same error:

python -m openmmplumed
Traceback (most recent call last):
  File "/home/zy/anaconda2/envs/py36/lib/python3.6/site-packages/openmmplumed.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/home/zy/anaconda2/envs/py36/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 560, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
ImportError: /home/zy/anaconda2/envs/py36/lib/python3.6/site-packages/_openmmplumed.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zy/anaconda2/envs/py36/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/zy/anaconda2/envs/py36/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/zy/anaconda2/envs/py36/lib/python3.6/site-packages/openmmplumed.py", line 17, in <module>
    _openmmplumed = swig_import_helper()
  File "/home/zy/anaconda2/envs/py36/lib/python3.6/site-packages/openmmplumed.py", line 16, in swig_import_helper
    return importlib.import_module('_openmmplumed')
  File "/home/zy/anaconda2/envs/py36/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 560, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
ImportError: /home/zy/anaconda2/envs/py36/lib/python3.6/site-packages/_openmmplumed.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev
peastman commented 6 years ago

Check the OpenMM lib directory to make sure the plugin (libOpenMMPlumed.so) really got installed into it. You might also need to add that directory to your LD_LIBRARY_PATH.

ljmartin commented 6 years ago

I have the same error. I have checked that libOpenMMPlumed.so is present in the directory that I added to LD_LIBRARY_PATH (indeed, the error is libOpenMMPlumed.so not found otherwise). In my case: export LD_LIBRARY_PATH=/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/:$LD_LIBRARY_PATH Are there any other angles to attack this?

PS the library doesn't appear to get loaded after from simtk.openmm import *:

>>> print(pluginLoadedLibNames)
('libOpenMMPME.so', 'libOpenMMCPU.so', 'libOpenMMCUDA.so', 'libOpenMMOpenCL.so', 'libOpenMMRPMDCUDA.so', 'libOpenMMDrudeCUDA.so', 'libOpenMMAmoebaCUDA.so', 'libOpenMMRPMDOpenCL.so', 'libOpenMMDrudeOpenCL.so', 'libOpenMMCudaCompiler.so', 'libOpenMMRPMDReference.so', 'libOpenMMDrudeReference.so', 'libOpenMMAmoebaReference.so')
>>> print(Platform.getPluginLoadFailures())
()
peastman commented 6 years ago

I think your error is a different one. It looks like you don't actually have it installed, since the Plumed related plugins aren't listed either in the loaded plugins nor in the load failures. Take a look in the lib and plugins folders. What files do they contain that have "plumed" in the names?

ljmartin commented 6 years ago

Yes, those files are present. ls lib: libOpenMMAmoeba.so libOpenMMDrude.so libOpenMMPlumed.so libOpenMMRPMD.so libOpenMM.so plugins python3.6 ls lib/plugins: libOpenMMAmoebaCUDA.so libOpenMMCudaCompiler.so libOpenMMDrudeOpenCL.so libOpenMMPlumedCUDA.so libOpenMMPME.so libOpenMMRPMDReference.so libOpenMMAmoebaReference.so libOpenMMCUDA.so libOpenMMDrudeReference.so libOpenMMPlumedOpenCL.so libOpenMMRPMDCUDA.so libOpenMMCPU.so libOpenMMDrudeCUDA.so libOpenMMOpenCL.so libOpenMMPlumedReference.so libOpenMMRPMDOpenCL.so One thing I notice is that the non-plumed entries are executable, the plumed ones are not. To get to that stage I had followed the directions on github, finishing with 'make install' and 'make PythonInstall', which both completed succesfullly (i.e. to 100%) with no errors, although a few warnings.

The only thing that concerned me is this, after make install:

 -- Set runtime path of "/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/libOpenMMPlumed.so" to ""
-- Installing: /home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/plugins/libOpenMMPlumedReference.so
-- Set runtime path of "/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/plugins/libOpenMMPlumedReference.so" to ""
-- Installing: /home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/plugins/libOpenMMPlumedOpenCL.so
-- Set runtime path of "/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/plugins/libOpenMMPlumedOpenCL.so" to ""
-- Installing: /home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/plugins/libOpenMMPlumedCUDA.so
-- Set runtime path of "/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/lib/plugins/libOpenMMPlumedCUDA.so" to ""

Should those "" be blank?

ljmartin commented 6 years ago

Not sure if relevant, but there were a number of these during make PythonInstall, but it finished without an Error:

/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/include/swig/OpenMMSwigHeaders.i:1091: Warning 453: Can't apply (OpenMM::Context &OUTPUT). No typemaps are defined.
/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/include/swig/OpenMMSwigHeaders.i:1123: Warning 453: Can't apply (std::vector< int > &OUTPUT). No typemaps are defined.
/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/include/swig/OpenMMSwigHeaders.i:1124: Warning 453: Can't apply (std::vector< double > &OUTPUT). No typemaps are defined.
/home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1/include/swig/OpenMMSwigHeaders.i:1134: Warning 453: Can't apply (std::string &OUTPUT). No typemaps are defined.
peastman commented 6 years ago

Are you sure you're looking at the right directories? Which directories were you listing the contents of? What is the output of print(version.openmm_library_path)? What about the environment variable OPENMM_PLUGIN_DIR?

ljmartin commented 6 years ago

print(version.openmm_library_path) is what I needed thanks! That gives /home/lewis/miniconda3/lib when I was trying to install into /home/lewis/miniconda3/pkgs/openmm-7.2.1-py36_1 based on a misunderstanding. I now set CMAKE_INSTALL_PREFIX to /home/lewis/miniconda, and the libraries are in the correct place, and loaded without failure using from simtk.openmm import *.

Unfortunately import openmmplumed returns the same error:

Type "help", "copyright", "credits" or "license" for more information.
>>> from simtk.openmm import *
>>> print(pluginLoadedLibNames)
('libOpenMMPME.so', 'libOpenMMCPU.so', 'libOpenMMCUDA.so', 'libOpenMMOpenCL.so', 'libOpenMMRPMDCUDA.so', 'libOpenMMDrudeCUDA.so', 'libOpenMMAmoebaCUDA.so', 'libOpenMMPlumedCUDA.so', 'libOpenMMRPMDOpenCL.so', 'libOpenMMDrudeOpenCL.so', 'libOpenMMCudaCompiler.so', 'libOpenMMPlumedOpenCL.so', 'libOpenMMRPMDReference.so', 'libOpenMMDrudeReference.so', 'libOpenMMAmoebaReference.so', 'libOpenMMPlumedReference.so')
>>> print(Platform.getPluginLoadFailures())
()
>>> import openmmplumed
Traceback (most recent call last):
  File "/home/lewis/miniconda3/lib/python3.6/site-packages/openmmplumed.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/home/lewis/miniconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /home/lewis/miniconda3/lib/python3.6/site-packages/_openmmplumed.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lewis/miniconda3/lib/python3.6/site-packages/openmmplumed.py", line 17, in <module>
    _openmmplumed = swig_import_helper()
  File "/home/lewis/miniconda3/lib/python3.6/site-packages/openmmplumed.py", line 16, in swig_import_helper
    return importlib.import_module('_openmmplumed')
  File "/home/lewis/miniconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /home/lewis/miniconda3/lib/python3.6/site-packages/_openmmplumed.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev

This is using a fresh install of openmm, and subsequently installing openmm-plumed. All I changed was what I found on this link: https://github.com/cocodataset/cocoapi/issues/94 i.e. adding extra_link_args=['-L/usr/lib/x86_64-linux-gnu/'] to setup.py Thanks for your time here!

peastman commented 6 years ago

What is the output of the following command?

ldd /home/lewis/miniconda3/lib/python3.6/site-packages/_openmmplumed.cpython-36m-x86_64-linux-gnu.so
ljmartin commented 6 years ago
ldd /home/lewis/miniconda3/lib/python3.6/site-packages/_openmmplumed.cpython-36m-x86_64-linux-gnu.so
    linux-vdso.so.1 =>  (0x00007ffe7fdec000)
    libOpenMM.so => /home/lewis/miniconda3/lib/libOpenMM.so (0x00007f4051c72000)
    libOpenMMPlumed.so => /home/lewis/miniconda3/lib/libOpenMMPlumed.so (0x00007f4051a67000)
    libstdc++.so.6 => /home/lewis/miniconda3/lib/libstdc++.so.6 (0x00007f40516da000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f40513d1000)
    libgcc_s.so.1 => /home/lewis/miniconda3/lib/libgcc_s.so.1 (0x00007f40511bb000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4050f9e000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4050bd4000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f40509cc000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f40507c8000)
    libplumed.so => /home/lewis/miniconda3/lib/libplumed.so (0x00007f404ff94000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4052387000)
    libgomp.so.1 => /home/lewis/miniconda3/lib/./libgomp.so.1 (0x00007f404fd73000)
peastman commented 6 years ago

That all looks ok. It knows how to link to libOpenMMPlumed.so, which is where that symbol should be defined. Ok, try this command:

nm -D /home/lewis/miniconda3/lib/libOpenMMPlumed.so | grep getScript
ljmartin commented 6 years ago

Thanks - its entered black box territory for me here. nm -D /home/lewis/miniconda3/lib/libOpenMMPlumed.so | grep getScript 0000000000008004 T _ZNK12PlumedPlugin11PlumedForce9getScriptEv

peastman commented 6 years ago

That gives us a good clue. libOpenMMPlumed.so contains the symbol _ZNK12PlumedPlugin11PlumedForce9getScriptEv, but the SWIG wrapper is looking for _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev. Those are almost but not quite the same. It looks like they've been compiled with slightly different options. In particular, the string "cxx11" in the SWIG version suggests the problem may be that libOpenMMPlumed.so was compiled without C++11 support.

Do you have the very latest code from this repository? The CMake script specifies to use C++11, but I just added that recently (https://github.com/peastman/openmm-plumed/commit/2c2c9d8484f0875575f69c5a50a34f6a90405e5f). Make sure your code is up to date, then run cmake, then do a make clean and recompile.

ljmartin commented 6 years ago

Cheers @peastman - I've used all up to date code and it is working - no failed plugins and can import properly.

For posterity, I believe I was using a version of plumed installed by acellera via conda. Removing and installing conda/openmm, plumed, and then openmmplumed with the latest build works now. Thanks so much!

shafferpr commented 6 years ago

Hi Peter and ljmartin, I'm having a tough time getting rid of this issue. My problems are very similar to ljmartins but don't seem to be resolved by using the latest build. I have just installed the latest version of openmm (7.2 via conda), plumed and this repo, but when I try to import openmmplumed I get:

import openmmplumed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/patrick/miniconda3/lib/python3.6/site-packages/openmmplumed.py", line 28, in <module>
    _openmmplumed = swig_import_helper()
  File "/home/patrick/miniconda3/lib/python3.6/site-packages/openmmplumed.py", line 24, in swig_import_helper
    _mod = imp.load_module('_openmmplumed', fp, pathname, description)
  File "/home/patrick/miniconda3/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/home/patrick/miniconda3/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: /home/patrick/miniconda3/lib/python3.6/site-packages/_openmmplumed.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev

As suggested, I tried this:

nm -D /home/patrick/miniconda3/lib/libOpenMMPlumed.so | grep getScript
0000000000008004 T _ZNK12PlumedPlugin11PlumedForce9getScriptEv

which suggests that libOpenMMPlumed.so is not being compiled with c++11, but I'm definitely using the latest version of openmm-plumed in which SET (CMAKE_CXX_STANDARD 11) is in CMakeLists.txt, but for some reason this doesn't seem to be enforced. One note: the file CmakeCache.txt that is generated by Cmake doesn't have any line referencing CMAKE_CXX_STANDARD in it. I don't know if this is relevant but it surprises me that this condition is not explicit in this file.

shafferpr commented 6 years ago

I ended up resolving this by installing openmm from source instead of Conda. I had to remove files associated with the previous conda install but once I did that everything is working smoothly.

CryoSky commented 3 years ago

Dear Peter, I meet this problem again as all previous users mentioned when I type import openmmplumed after installing. The error info is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/projects/cms16/sj52/miniconda3/lib/python3.7/site-packages/openmmplumed.py", line 26, in <module>
    _openmmplumed = swig_import_helper()
...
ImportError: /projects/cms16/sj52/miniconda3/lib/python3.7/site-packages/_openmmplumed.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev

I install both plumed and openmm by same conda environment. The openmm version is: 7.4.0.dev-b9a1bee, the Plumed version is: 2.6.1.

I have added the openMM installed path to the environment by export LD_LIBRARY_PATH='/projects/cms16/sj52/miniconda3/lib':$LD_LIBRARY_PATH. I also added -D_GLIBCXX_USE_CXX11_ABI=0 flag when compiling.

It's worth to mention that I met the same warning swig/OpenMMSwigHeaders.i:1091: Warning 453: Can't apply (OpenMM::Context &OUTPUT). No typemaps are defined. when type make PythonInstall. Although the compile still success (i.e. 100%), I guess this indicates that swig didn't find correct path?

Typed ldd /projects/cms16/sj52/miniconda3/lib/python3.7/site-packag es/_openmmplumed.cpython-37m-x86_64-linux-gnu.so I can get the following info:

ldd /projects/cms16/sj52/miniconda3/lib/python3.7/site-packag
es/_openmmplumed.cpython-37m-x86_64-linux-gnu.so
        linux-vdso.so.1 =>  (0x00007fffb650a000)
        /opt/apps/software/Core/xalt/default/lib64/libxalt_init.so (0x00007fb2ad38e000)
        libstdc++.so.6 => /projects/cms16/sj52/miniconda3/lib/libstdc++.so.6 (0x00007fb2ad651000)
        libgcc_s.so.1 => /projects/cms16/sj52/miniconda3/lib/libgcc_s.so.1 (0x00007fb2ad63c000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb2ad172000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fb2acda5000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fb2acba1000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fb2ac89f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb2ad5b4000)

I didn't find the link to libOpenMMPlumed.so, could that be a problem?

Type nm -D /projects/cms16/sj52/miniconda3/lib/python3.7/site-pack ages/_openmmplumed.cpython-37m-x86_64-linux-gnu.so | grep PlumedForce will get the following info: U _ZN12PlumedPlugin11PlumedForceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE U _ZNK12PlumedPlugin11PlumedForce9getScriptB5cxx11Ev However, my issue is not different from the previous one because the link is same the name in the error.

I have googled and found all related github issues within the same problem. I tried -D_GLIBCXX_USE_CXX11_ABI=1 as you suggested in another thread but that cannot pass the compiling. Btw, swig is also installed within the same conda environment and I have use the path in ccmake. I'm much appreciated it if you could give some suggestions on how to fix this. Many thanks for your help in advance!

CryoSky commented 3 years ago

Hi Peter and everyone, I think the bug has solved by the hint from this page https://github.com/openmm/openmm-plumed/issues/24. I have the same error, add STRING=-D_GLIBCXX_USE_CXX11_ABI=0 to the CMAKE_CXX_FLAGS in ccmake advanced mode can compile successfully, but will get the error when import openmmplumed. However, not add this option to CMAKE_CXX_FLAGS cannot pass the compilation. My solution is same as the page. Adding '-D_GLIBCXX_USE_CXX11_ABI=0' to extra_compile_args in setup.py solved the problem. Remember to make clean at first.

melodyleungtc commented 3 years ago

Hello,

I installed OpenMM 7.4.2.dev-dc9d188 with conda. Compilation and make PythonInstall seems to work without any errors. However, when I try to import openmmplumed in python, I get the following:

ImportError: /project2/andrewferguson/melody/env_melody/lib/libOpenMMPlumed.so: undefined symbol: _ZNK6OpenMM8Platform12createKernelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ContextImplE

The plumed libraries do not seem to load:

from simtk.openmm.app import *
from simtk.openmm import *
print(pluginLoadedLibNames)
('/project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMCPU.so', 
'/project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMPME.so', 
'/project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMRPMDReference.so', 
'/project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMDrudeReference.so', 
'/project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMAmoebaReference.so')

print(Platform.getPluginLoadFailures())
('Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMCUDA.so: libcuda.so.1: cannot open shared object file: No such file or directory', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMOpenCL.so: libOpenCL.so.1: cannot open shared object file: No such file or directory', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMPlumed.so: /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMPlumed.so: undefined symbol: _ZNK6OpenMM8Platform12createKernelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ContextImplE', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMRPMDCUDA.so: libOpenMMCUDA.so: cannot open shared object file: No such file or directory', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMDrudeCUDA.so: libOpenMMCUDA.so: cannot open shared object file: No such file or directory', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMAmoebaCUDA.so: libOpenMMCUDA.so: cannot open shared object file: No such file or directory', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMRPMDOpenCL.so: libOpenCL.so.1: cannot open shared object file: No such file or directory', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMDrudeOpenCL.so: libOpenCL.so.1: cannot open shared object file: No such file or directory', 
'Error loading library /project2/andrewferguson/melody/env_melody/lib/plugins/libOpenMMCudaCompiler.so: libnvrtc.so.10.0: cannot open shared object file: No such file or directory')

Looking into the lib and plugins folder, these files are present in each:

lib: libOpenMM.so libOpenMMAmoeba.so libOpenMMDrude.so libOpenMMPlumed.so libOpenMMRPMD.so libplumed.so libplumedKernel.so libplumedWrapper.a

lib/plugins: libOpenMMAmoebaCUDA.so libOpenMMCudaCompiler.so libOpenMMOpenCL.so libOpenMMRPMDOpenCL.so libOpenMMAmoebaReference.so libOpenMMDrudeCUDA.so libOpenMMPME.so libOpenMMRPMDReference.so libOpenMMCPU.so libOpenMMDrudeOpenCL.so libOpenMMPlumed.solibOpenMMCUDA.so libOpenMMDrudeReference.so libOpenMMRPMDCUDA.so

I have also tried the following based on previous comments: including CMAKE_CXX_FLAGS -D_GLIBCXX_USE_CXX11_ABI=0 in the cmake advanced settings adding ‘-D_GLIBCXX_USE_CXX11_ABI=0’ to extra_compile_args in setup.py export LD_LIBRARY_PATH= /project2/andrewferguson/melody/env_melody/lib/:$LD_LIBRARY_PATH

Could you help me with this?

Thank you so much for your time! Melody

raimis commented 3 years ago

@melodyleungtc opemm-plumed package soon will be on codna-forge (https://github.com/conda-forge/staged-recipes/pull/13486).

You can try the latest builds (https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=265438&view=artifacts&pathAsName=false&type=publishedArtifacts).

melodyleungtc commented 3 years ago

@raimis That's great. Thank you for the links and update!

jaimergp commented 3 years ago

@melodyleungtc They are now available in case you didn't see it! Check the Readme for instructions if needed :)

raimis commented 3 years ago

We already provide a conda package (https://github.com/openmm/openmm-plumed#installing-the-plugin). The regular users should no longer need to build the plugin from the source code and face similar issues.