6. Appendix: Installing the code in this primer and the required packages

Each tutorial outlines how to install all of the necessary software. The following is a consolidated guide to installing all of the software needed for the tutorials.

6.1. Requirements

Below is a list of all of the packages needed for the tutorials. Note, each tutorial only requires a subset of these packages. Please see the tutorials for information about the packages required for each tutorial.

In addition, the following packages are optional

6.2. How to install these tutorials

Run the following command to install the latest version from GitHub:

pip install https://github.com/KarrLab/wc_utils.git#egg=wc_utils
pip install https://github.com/KarrLab/obj_tables.git#egg=obj_tables
pip install https://github.com/KarrLab/wc_lang.git#egg=wc_lang
pip install https://github.com/KarrLab/intro_to_wc_modeling.git#egg=intro_to_wc_modeling

6.3. Detailed instructions to install the tutorials and all of the requirements

  1. Follow the instructions in How to build a Ubuntu Linux image with Docker to build a Linux virtual machine

  2. Install several packages

    1. Enable the Docker Aptitude repository:

      curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
      sudo add-apt-repository \
         "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
         xenial \
      sudo apt-get update
    2. Install several packages from the Mint repository:

      sudo apt-get install \
          apt-transport-https \
          ca-certificates \
          curl \
          docker-ce \
          gimp \
          git \
          ipython \
          ipython3 \
          inkscape \
          libgnome-keyring-dev \
          libpython-dev \
          libpython3-dev \
          meld \
          mysql-server \
          python \
          python3 \
          python-pip \
          python3-pip \
          software-properties-common \
          texlive \
    3. Install support for large file in Git repositories:

      curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
      sudo apt-get install git-lfs
      git lfs install
    4. Install Open Babel:

      wget https://github.com/openbabel/openbabel/archive/openbabel-2-4-1.tar.gz -O /tmp/openbabel-2.4.1.tar.gz
      tar -xvvf /tmp/openbabel-2.4.1.tar.gz
      cd openbabel-openbabel-2-4-1
      mkdir build
      cd build
      cmake ..
      make install
    5. Install ChemAxon Marvin

      1. Install Java:

        apt-get install default-jre default-jdk
      2. Download the installer from https://chemaxon.com/products/marvin/download

      3. Install ChemAxon Marvin:

        export version_marvin=19.3
        dpkg -i marvin_linux_${version_marvin}.deb
      4. Set JAVA_HOME to the path to your Java virtual machine (JVM):

        export JAVA_HOME=/usr/lib/jvm/default-java
      5. Add Marvin to the Java class path:

        export CLASSPATH=$CLASSPATH:/opt/chemaxon/marvinsuite/lib/MarvinBeans.jar
      6. Obtain a license at https://docs.chemaxon.com/display/docs/About+ChemAxon+Licensing. Free 2-year licenses are available for academic research.

      7. Download your license from https://accounts.chemaxon.com/my/licenses

      8. Save your your license to ~/.chemaxon/license.cxl

    6. Install the CPLEX optimization package and the CPLEX Python binding

      1. Register for an academic account and download CPLEX from https://ibm.onthehub.com

      2. Install CPLEX:

        chmod ugo+x cplex_studio128.linux-x86-64.bin
      3. Install the Python binding:

        # Python 3.6
        cd /opt/ibm/ILOG/CPLEX_Studio128/cplex/python/3.6/x86-64_linux/
        pip3.6 install .
    7. Optionally, install the COIN-OR Cbc optimization package and the CyLP Python binding:

      # set environment variables
      echo "" >> ~/.bashrc
      echo "# COIN-OR: CoinUtils, Cbc" >> ~/.bashrc
      echo "export COIN_INSTALL_DIR=/opt/coin-or/cbc" >> ~/.bashrc
      echo "export PATH=\"\${PATH}:/opt/coin-or/cbc/bin:/opt/coin-or/coinutils/bin\"" >> ~/.bashrc
      echo "export LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:/opt/coin-or/cbc/lib:/opt/coin-or/coinutils/lib\"" >> ~/.bashrc
      # CoinUtils
      cd /tmp
      wget --no-check-certificate https://www.coin-or.org/download/source/CoinUtils/CoinUtils-2.10.14.tgz
      tar -xvvf CoinUtils-2.10.14.tgz
      cd CoinUtils-2.10.14
      mkdir build
      cd build
      mkdir -p /opt/coin-or/coinutils
      ../configure -C --prefix=/opt/coin-or/coinutils --enable-gnu-packages
      make install
      # COIN-OR Cbc
      wget --no-check-certificate https://www.coin-or.org/download/source/Cbc/Cbc-2.8.5.tgz
      tar -xvvf Cbc-2.8.5.tgz
      cd Cbc-2.8.5
      mkdir build
      cd build
      ../configure -C --prefix=/opt/coin-or/cbc --enable-gnu-packages
      make install
      # CyLP
      pip install numpy scipy
      pip install git+https://github.com/jjhelmus/CyLP.git@py3#egg=cylp
    8. Optionally, install the Gurobi optimization package and the Gurobi Python binding

      1. Get a Gurobi license from http://www.gurobi.com. Gurobi provides free licenses for academic users.

      2. Install Gurobi:

        wget http://packages.gurobi.com/8.1/gurobi8.1.0_linux64.tar.gz
        tar xvfz gurobi8.1.0_linux64.tar.gz
        mv gurobi810 /opt/
        echo "" >> ~/.bashrc
        echo "# Gurobi" >> ~/.bashrc
        echo "export GUROBI_HOME=/opt/gurobi810/linux64" >> ~/.bashrc
        echo "export PATH=\"\${PATH}:\${GUROBI_HOME}/bin\"" >> ~/.bashrc
        echo "export LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:\${GUROBI_HOME}/lib\"" >> ~/.bashrc
      3. Use your license to activate Gurobi:

        /opt/gurobi810/linux64/bin/grbgetkey "<license>"
      4. Install the Python binding:

        cd /opt/gurobi810/linux64
        python setup.py install
    9. Optionally, install the MINOS optimization package and the MINOS Python binding:

      1. Request an academic license from Michael Saunders

      2. Use the following commands to compile MINOS:

        apt-get install csh gfortran
        cd /path/to/parent of quadLP.zip
        unzip quadLP.zip
        cd quadLP/minos56
        sed -i 's/FC        = gfortran/FC        = gfortran -fPIC/g' Makefile.defs
        make clean
        cd /tmp/quadLP/minos56/test
        make minos
        ./run minos t1diet
        sed -i 's/FC        = gfortran/FC        = gfortran -fPIC/g' Makefile.defs
        make clean
        cd /tmp/quadLP/qminos56/test
        make minos
        ./run minos t1diet
      3. Use the following commands to install the MINOS Python binding:

        git clone https://github.com/SBRG/solvemepy.git
        cd solvemepy
        cp /path/to/quadLP/minos56/lib/libminos.a ./
        cp /path/to/quadLP/qminos56/lib/libquadminos.a ./
        pip install .
    10. Optionally, install the MOSEK optimization package and the Mosek Python binding:

      1. Request an academic license at https://license.mosek.com/academic

      2. Recieve a license by email

      3. Save the license to ${HOME}/mosek/mosek.lic

      4. Install Mosek:

        cd /tmp
        wget --no-check-certificate https://d2i6rjz61faulo.cloudfront.net/stable/
        tar -xvvf mosektoolslinux64x86.tar.bz2
        mv /tmp/mosek /opt/
        echo "" >> ~/.bashrc
        echo "# Mosek" >> ~/.bashrc
        echo "export PATH=\"\${PATH}:/opt/mosek/8/tools/platform/linux64x86/bin\"" >> ~/.bashrc
        echo "export LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:/opt/mosek/8/tools/platform/linux64x86/bin\"" >> ~/.bashrc
      5. Install the Python binding:

        # Python 3.6
        cd /opt/mosek/8/tools/platform/linux64x86/python/3/
        python3.6 setup.py install
    11. Optionally, install the SoPlex optimization package and the SoPlex Python binding:

      1. Download SoPlex 3.1.1 from http://soplex.zib.de/#download

      2. Use the following commands to install SoPlex:

        cd /path/to/parent of soplex-3.1.1.tgz
        tar -xvvf soplex-3.1.1.tgz
        cd soplex-3.1.1
        mkdir build
        cd build
        cmake ..
        make test
        make install
      3. Use the following commands to install the SoPlex Python binding:

        apt-get install libgmp-dev
        pip install cython
        git clone https://github.com/SBRG/soplex_cython.git
        cd soplex_cython
        cp /path/to/soplex-3.1.1.tgz .
        pip install .
    12. Optionally, install the XPRESS optimization package and the XPRESS Python binding

      1. Download and unpack XPRESS:

        cd /tmp
        wget --no-check-certificate https://clientarea.xpress.fico.com/downloads/8.5.6/xp8.5.6_linux_x86_64_setup.tar
        mkdir xp8.5.6_linux_x86_64_setup
        tar -xvvf xp8.5.6_linux_x86_64_setup.tar -C xp8.5.6_linux_x86_64_setup
      2. Get your host id:

        cd /tmp/xp8.5.6_linux_x86_64_setup
        utils/xphostid | grep -m 1 "<id>" | cut -d ">" -f 2 | cut -d "<" -f 1
      3. Use your host id to create a license at https://app.xpress.fico.com

      4. Save the license to /tmp/xpauth.xpr

      5. Install XPRESS. Note, the standard library directory needs to be added to the library path to prevent the OS from using the versions of libcrypto and libssl provided by XPRESS.:

        cd /tmp/xp8.5.6_linux_x86_64_setup
        echo "" >> ~/.bashrc
        echo "# XPRESS" >> ~/.bashrc
        echo "export XPRESSDIR=/opt/xpressmp" >> ~/.bashrc
        echo "export PATH=\"\${PATH}:\${XPRESSDIR}/bin\"" >> ~/.bashrc
        echo "export LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:/lib/x86_64-linux-gnu:\${XPRESSDIR}/lib\"" >> ~/.bashrc
        echo "export CLASSPATH=\"\${CLASSPATH}:\${XPRESSDIR}/lib/xprs.jar:\${XPRESSDIR}/lib/xprb.jar:\${XPRESSDIR}/lib/xprm.jar\"" >> ~/.bashrc
        echo "export XPRESS=\"\${XPRESSDIR}/bin\"" >> ~/.bashrc
      6. Setup the XPRESS Python binding:

        • Add XPRESS to your Python path:

          # Python 3.6
          echo "/opt/xpressmp/lib" | tee /usr/local/lib/python3.6/site-packages/xpress.pth
        • Save the following package meta data to /usr/local/lib/python3.6/site-packages/xpress-8.5.6.egg-info for Python 3.6:

          Metadata-Version: 1.0
          Name: xpress
          Version: UNKNOWN
          Summary: FICO Xpress-Optimizer Python interface
          Home-page: http://www.fico.com/en/products/fico-xpress-optimization
          Author: Fair Isaac Corporation
          Author-email: UNKNOWN
          License: UNKNOWN
              Xpress-Python interface
              Copyright (C) Fair Isaac 2016
              Create, modify, and solve optimization problems in Python using the Xpress Optimization suit
          Platform: UNKNOWN

      Note: If you want to install XPRESS onto a cluster, virtual machine, or docker image, you should first install a XPRESS license server on a static host and then install XPRESS using a floating license. See the XPRESS documentation for more information.

    13. Install the SUNDIALS ODE solver and the scikits.odes Python interface:

      1. Install the Fortran and BLAS:

        apt-get install \
            build-essential \
            cmake \
            gfortran \
            libopenblas-base \
            libopenblas-dev \
      2. Download, compile, and install SUNDIALS 3.2.1:

        cd /tmp
        wget https://computation.llnl.gov/projects/sundials/download/sundials-3.2.1.tar.gz
        tar xzf sundials-3.2.1.tar.gz
        cd sundials-3.2.1
        mkdir build
        cd build
        cmake \
            -DLAPACK_ENABLE=ON \
            -DSUNDIALS_INDEX_TYPE=int32_t \
        make install
      3. Install scikits.odes:

        pip install scikits.odes
      4. Remove SUNDIALS source files:

        cd /tmp
        rm sundials-3.2.1.tar.gz
        rm -r sundials-3.2.1
    14. Install the Sublime text editor:

      sudo add-apt-repository ppa:webupd8team/sublime-text-3
      sudo apt-get update
      sudo apt-get install sublime-text-installer
    15. Install the PyCharm IDE:

      sudo mv ~/Downloads/pycharm-community-2018.3.5.tar.gz /opt/
      sudo tar -xzf pycharm-community-2018.3.5.tar.gz
      cd pycharm-community-2018.3.5/bin
      ./pycharm.sh &
    16. Install the CircleCI command line tool:

      sudo curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci
      sudo chmod +x /usr/local/bin/circleci
    17. Purchase and install Illustrator

  3. Configure the packages

    1. Configure your Git user name and email:

      git config --global user.name "John Doe"
      git config --global user.email "johndoe@example.com"
    2. Configure Git to store your GitHub password:

      cd /usr/share/doc/git/contrib/credential/gnome-keyring
      sudo make
      git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring
    3. Add the following to ~/.gitconfig to configure Git to use meld to visualize differences:

          tool = meld
          prompt = false
      [difftool "meld"]
          cmd = meld "$LOCAL" "$REMOTE"
    4. Open Sublime and edit the following settings

      • Tools >> Install Package Control

      • Preferences >> Package control >> Install package >> AutoPEP8

      • Preferences >> Key Bindings:

            {"keys": ["ctrl+shift+r"], "command": "auto_pep8", "args": {"preview": false}}
    5. Open PyCharm and set the following settings to configure PyCharm

      • File >> Settings >> Tools >> Python Integrated Tools >> Default test runner: set to py.test
      • Run >> Edit configurations >> Defaults >> Python tests >> py.test: add additional arguments “–capture=no”
      • Run >> Edit configurations >> Defaults >> Python tests >> Nosetests: add additional arguments “–nocapture”
    6. Configure Docker:

      sudo usermod -aG docker $USER
    7. Install Docker Compose:

      sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
      sudo chmod +x /usr/local/bin/docker-compose
    8. Optional, setup IDEs such as PyCharm to run code using a Docker image, such as, an image created with wc_env_manager.