Site icon EdwardsLab

Installing PyFBA (and necessary modules) without admin permissions

As easy as it is to install PyFBA using the pip command, it can be quite cumbersome to do so when you are working on a system without granted administrative or sudo permissions. Here is a quick guide that has worked for me when installing PyFBA on a CentOS 6.3 system running a SunGrid Engine cluster system. If you are working on a Linux system and you do have admin and sudo permissions, please follow the install guide here.

Perform the following to install each module separately.

# Clone PyFBA from GitHub
cd; git clone https://github.com/linsalrob/PyFBA.git

# Clone ModelSEEDDatabase from GitHub
git clone https://github.com/ModelSEED/ModelSEEDDatabase.git

# As of July 26, 2017, PyFBA is not compatible with the refactored ModelSEED GitHub repo
# so we must roll back to a previous version
# The following commit will checkout the June 1, 2017 snapshot:
# https://github.com/ModelSEED/ModelSEEDDatabase/tree/c4ba1c6a2aa81dae6159323c95a4236619c3d9ce
cd ModelSEEDDatabase
git checkout c4ba1c6

# Create ENV variables and add to the .bashrc file
export ModelSEEDDatabase=${HOME}/ModelSEEDDatabase
echo 'export ModelSEEDDatabase=${HOME}/ModelSEEDDatabase' >> ${HOME}/.bashrc
export PYFBA_MEDIA_DIR=${HOME}/PyFBA/media
echo 'export PYFBA_MEDIA_DIR=${HOME}/PyFBA/media' >> ${HOME}/.bashrc

# In HOME directory, make glpk directory and download glpk
cd; mkdir glpk; cd glpk;
wget ftp://mirrors.kernel.org/gnu/glpk/glpk-4.63.tar.gz
tar xzf glpk-4.63.tar.gz

# Make a glpk binary folder to store make files in since make tries to install in /usr/local/
# where we do not have write permissions
mkdir glpk_bin
cd glpk-4.63

# Configure and make
# configure took about 10 seconds, make took about 2 minutes
# --with-gmp flag enables the simplex solver to use GNU MP bignum library
./configure --with-gmp
make prefix=~/glpk/glpk_bin install

# Add library path to LD_LIBRARY_PATH and add to the .bashrc file
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/glpk/glpk_bin/lib
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/glpk/glpk_bin/lib' >> ${HOME}/.bashrc

# Also need to add glpsol binary to PATH
export PATH=$PATH:${HOME}/glpk/glpk_bin/bin
echo 'export PATH=$PATH:${HOME}/glpk/glpk_bin/bin' >> ${HOME}/.bashrc

# Go back to HOME directory and clone PyGLPK from GitHub
cd; git clone https://github.com/bradfordboyle/pyglpk.git

# Go to PyGLPK folder and run setup
# Again, since this is a local setup we need to add the user flag. This will install module in
# your home directory under the .local/ directory. It should already be in your Python sys path
# Info can be found here:
# https://docs.python.org/3.3/install/index.html#alternate-installation-the-user-scheme
# setup.py took about 5 seconds
cd pyglpk
python3 setup.py install --user

# Check that install works
python3 -c 'import glpk; print("Import works!")'

# You can also run the tests PyGLPK comes with. It should only take about 1 second
# This script runs 265 tests. You should get a message at the end saying:
# 'TESTS PASSED!! 265 tests total'
python3 tests/test_glpk.py

# It is now safe to remove the tarball that was downloaded
rm ../glpk-4.63.tar.gz

# Install Beautiful Soup 4 module
pip3 install --user beautifulsoup4
python3 -c 'import bs4; print("Import works!")'

# Install SBML module
pip3 install --user python-libsbml-experimental
python3 -c 'import libsbml; print("Import works!")'

# Install networkx module
pip3 install --user networkx
python3 -c 'import networkx; print("Import works!")'

# At this point all modules for PyFBA should be installed and set up
# PyFBA comes with a test code to check that PyFBA is behaving as expected
cd ~/PyFBA/PyFBA
nosetests-3.4 tests
Exit mobile version