You are here

Trouble building PyRosetta on Linux Mint 13 (Maya) 64-bit / Ubuntu 12.04 (Precise Pangolin)

4 posts / 0 new
Last post
Trouble building PyRosetta on Linux Mint 13 (Maya) 64-bit / Ubuntu 12.04 (Precise Pangolin)

Hi mini,

I had a little trouble building PyRosetta r46030 64-bit on Linux Mint 13 (Maya) 64-bit. This revision corresponds to PyRosetta v2.011. The problems were easy to fix but since they are currently undocumented*, I thought I would list the problems and solutions here. The main problem I had seems specific to Python 2.6 and certain Ubuntu/Mint distributions so it is no surprise that it is not in the documentation. I include all the steps I took for completeness and add some comments for those new to Linux.

Everything below was tested on Linux Mint 13. However, since Mint closely follows Ubuntu, the solution may also work on Ubuntu 12.04.

Mint 13 comes with Python 2.7.3 so I started by installing Python 2.6.8 as an optional installation. As a general rule of thumb, never overwrite your the default Python installation on your Linux OS as this can mess up your package manager which can mess up your OS (is this true for Mac OS X?). The steps below are specific to Debian distributions e.g. Ubuntu and Mint. For RHEL distributions e.g. CentOS, the steps are similar but 'yum' is used instead of 'apt-get' and some packages are named differently e.g. I believe libbz2-dev is bzip2-devel in RHEL distributions.

Install basic development packages

This list may not be sufficient and necessary for building Python for PyRosetta. Maybe someone can correct me here:

sudo apt-get install build-essential libbz2-dev libncursesw5-dev libreadline-gplv2-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev mysql-client libmysqlclient-dev

If this command fails, remove the failed package(s) from the apt-get command line and try again. Take note of those that failed though in case they are needed. You may need libreadline5-dev instead of libreadline-gplv2-dev.

Determine whether your Linux kernel is 32-bit or 64-bit

Run this command:
uname -a
If you see x86_64 then you have a 64-bit kernel. Otherwise, it is 32-bit.

Download and build Python 2.6.8 (Python 2.6 is needed for PyRosetta on 64-bit Linux)

Run these commands:
gunzip -c Python-2.6.8.tgz | tar -xvf -
cd Python-2.6.8

Make a directory where Python 2.6 will be installed

sudo mkdir /opt/python2.6
sudo chown yourusername:yourprimarygroup /opt/python2.6/

Build Python:

If you are using Linux Mint 13 (Maya) or Ubuntu 11.04 then your bz2 library ( may be installed in a non-standard location e.g. /usr/lib/x86_64-linux-gnu and Python 2.6 is not configured to search this path. This may be true for other distributions as well. In this case, you will need the following variable to be set in your environment:

export LDFLAGS="-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)"

We now build Python with options required for PyRosetta:

./configure --prefix=/opt/python2.6 --with-threads --enable-shared --enable-unicode=ucs4
make install

Again, if you are using Linux Mint 13 or Ubuntu 11.04, unset the variable we set above:


Note that we have configured Python to install to /opt/python2.6. This ensures that we leave our existing installation, which may be crucial to the OS, safe. PyRosetta needs the --enable-shared option (which builds shared libaries) and the --enable-unicode option. If you have a modern Linux distribution then --enable-unicode=ucs4 (wide unicode character support) should be the correct option. One forum user needed to use --enable-unicode=ucs2 to build PyRosetta 1.1 on 32-bit machine but possibly this was due to PyRosetta 1.1 using an older version of Python? If someone knows, please answer below.

Configure the dynamic loader to find the Python 2.6 shared libraries

One way to achieve this is to edit the /etc/ file.
sudo vi /etc/

Check the man page ('man ld') to check how this file is structured. It may be enough to add this path on a new line in the file:

Enforce the changes.
sudo ldconfig

Run PyRosetta

After following the installation instructions on the PyRosetta website (make sure to run, you should be able to run:
>> import rosetta

without any errors.

Hope this helps,

* I am not counting the forums as documentation even though the usual problem-solvers do a fantastic job.

Post Situation: 
Fri, 2012-06-29 14:44

Wow, thanks Shane!

Fri, 2012-06-29 14:46

Cheers. I may edit some of the above based on some information Sergey is telling me. The process may be made simpler by scripts in the repository. Also, it is possible that I did not need to install Python 2.6; I wanted to install that specifically, ironically to avoid issues that another lab member had on Mac OS X vSomething using that distribution's standard Python package (v2.7.x).

[edit] Based on forum posts from Alex and Rocco, I tried installing libpython2.6 on a fresh Mint 13 (mmm, fresh mints) box with no PyRosetta installed. This may have been sufficient to get PyRosetta running without going through all the steps above. However, this package could not be found. It looks like the libpython2.6 package has been removed from the Ubuntu 12.04 repository ( Mint 13 is compatible with the Ubuntu 12.04 repository ( so presumably this package has been removed from Mint as well.

Fri, 2012-06-29 15:52

This is Great Shane, thank you for putting this together! I have added link to this post to our PyRosetta website. A few notes that might be helpful:

- It is possible to use any of the following versions of Python to build PyRosetta: 2.5, 2.6 and 2.7.

- If you do not have root access to your machine then it is possible to use and install desired version of Python locally in your home folder and use it to build/run PyRosetta. This will also allow you to not disturb system wide install of python in case you want to preserve it.

Mon, 2012-07-09 12:50