How to use PyMOL free libre, or | How to compile PyMOL from source on Ubuntu 18.04

This will allow you to run PyMOL without an aqcuired license which you certainly would need if you were to use the compiled binaries provided from the PyMOL website. This is just a very simple guide providing a list of the packages you need to install, and showing how to run the scripts you need to download the source code and compile the program.
The version of the program will be a little stripped of menus and such, so you will need to rely more on command line interface arguments to use it.

From what I can gather the program used to be totally free, but the original developer passed away unexpectedly in 2009, after which it was acquired by Schrödinger, Inc. While the company does keep some of their updates closed source, requiring users to pay for a license, most of the functionality is still there in the Open Source version. There are also some rumors of provided binaries out there, but if you compile it yourself like this here, you will be sure to have the latest updates (last update 21 days ago at the time of writing), and you don't have to trust a third party not to put a virus in the program they give you for free for no reason.

If you're interested to see when the project was last updated, or just inspect the code, visit the project on github:
https://github.com/schrodinger/pymol-open-source

Now, just run these commands in your terminal and you should end up with a pymol executable on your computer in just a few minutes!

Install the required dependencies for compiling:

sudo apt-get install freeglut3-dev libglew-dev mesa-utils mesa-common-dev binutils libxml2-dev libmsgpack-dev python3-pip libglm-dev libpng-dev libfreetype6-dev git

Install the python Qt5 library, which is a python library, so it has to be installed with the python package manager pip that you just installed:

pip3 install PyQt5

Download the source code (i.e. clone the git repository)

git clone https://github.com/schrodinger/pymol-open-source.git

Enter the pymol source code directory that was just downloaded by git:

cd pymol-open-source

Run the install script, placing the compiled binaries in $HOME/programs/PyMOL or wherever you like

python setup.py install --prefix=~/programs/PyMOL/ --use-msgpackc=no

(Optional) Add the location of the compiled executable to your PATH, so you can run the program from anywhere in the terminal:

put the following in ~/.bashrc

export PYMOL_HOME=$HOME/programs/PyMOL
export PATH=$PATH:$PYMOL_HOME/bin

Now close your terminal and open a new one to reload the PATH variables.

And finally run

pymol

Or, if you didn't do the optional PATH step, cd into the directory you specified when running the script, and run ./pymol

You can also make a menu short cut entry by copying one of the .desktop files in /usr/share/applications/ and changing it to point to the location of your pymol executable.

Leave a Reply

Your email address will not be published. Required fields are marked *