Fixing Pyrosetta Binaries to work with Anaconda Python on MacOSX
Assuming your Anaconda Python is at the front of your path (type 'which ipython' to verify that it is using the Anaconda version). Here, Anaconda is installed in ~/anaconda
System Commands are preceded with ">"
Python Commands are preceded with ">>"
If you download the Pyrosetta Binaries, unzip them, source the SetPyrosettaEnvironment.sh and run ipython while using Ananconda's version of Ipython, you may see the following error:
>>from rosetta import * Fatal Python error: PyThreadState_Get: no current thread
This is because there is a mismatch in the python modules that are being loaded. You are running Anaconda Ipython and importing the associated modules. However, the default build for Pyrosetta is against the system install of Python (located somewhere like /System/Library/Frameworks/Python.framework/Versions/2.7/Python)
In fact, you can check the dependence of the Pyrosetta dynamic libraries (called rosetta.so in the main directory) by typing the following:
> otool -L rosetta.so
- /Volumes/scratch/benchmark/rosetta.Hikaru/master/main/source/build/PyRosetta/macos/monolith/release/build/../rosetta.so (compatibility version 0.0.0, current version 0.0.0)
- /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
- /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
- /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)
- /Users/steve/pyrosetta_download/PyRosetta.monolith.mac.master-58318/libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
- /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
Note the line in Bold, where the rosetta.so binary calls the System Python library.... this leads to the crash mentioned above. The first step to fix this is to change the rosetta.so binary to use Anaconda's Python Library This can be achieved with the following command:
>install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /Users/steve/anaconda/lib/libpython2.7.dylib rosetta.so
This fixes the rosetta.so binary, but we also need to change the libboost_python.dylib in the same directory
>install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /Users/steve/anaconda/lib/libpython2.7.dylib libboost_python.dylib
That's it! Now you should be able to successfully run:
>source SetPyrosettaEnironment.sh >ipython >> from rosetta import * >> rosetta.init()
using Anaconda's I/Python!