Page 1 of 1

"dyld: Library not loaded: LibMMBlib.dylib" in python 3.7.11 on MacOS 10.14.6

Posted: Sat Oct 23, 2021 6:06 pm
by taoliu032
Hi there,

I've been using MMB to fold ssDNA into their 3D structure, many thanks for developing such a useful tool! Recently I would like to run MMB in a python environment and I came across an error regarding loading the dylib files.

Platform info: Python 3.7.11; MacOS 10.14.6 (Mojave).
Problem description:
1. First of all, I can successfully run the MMB program in command line as below, following the MMB tutorial document:
"
$ export DYLD_LIBRARY_PATH=/Users/taoliu/Desktop/software/Installer.3_0.OSX/lib
$ /Users/taoliu/Desktop/software/Installer.3_0.OSX/bin/MMB -c commands.run_fold.txt
"
This runs with no error /cheers.

2. Then I try to do the same thing in a python environment by using the "os" package, as shown in the following simple python script:
myTestMMB.py:
"
import os
os.environ["DYLD_LIBRARY_PATH"] = '/Users/taoliu/Desktop/software/Installer.3_0.OSX/lib'
os.system('/Users/taoliu/Desktop/software/Installer.3_0.OSX/bin/MMB -c commands.run_fold.txt')
"
And to be safe, I also have added the environment variable DYLD_LIBRARY_PATH to the .bash_profile.

However, the python script above cannot run successfully and always gives such an error:
"
dyld: Library not loaded: libMMBlib.dylib
Referenced from: /Users/taoliu/Desktop/software/Installer.3_0.OSX/bin/MMB
Reason: image not found

Process finished with exit code 0
"
Furthermore, if I ask python to show me the environment variable by "print(os.environ["DYLD_LIBRARY_PATH"]), it outputs the correct path.

Therefore, it seems like the MMB executable somehow cannot find the library, even if the "libMMBlib.dylib" and other .dylib files do exist in the "/Users/taoliu/Desktop/software/Installer.3_0.OSX/lib" directory.

I wonder if anyone has experience in running MMB in a python environment on MacOS? Any suggestions or guidance is really appreciated, thank you very much! Please let me know if you need any other information to help with the debugging.