Installing Pyomo Trunk Using Pip

Need to try out a new feature or fix that will be in the next Pyomo release?  Then you will want to install Pyomo from trunk. In most cases, this can be accomplished using the pyomo_install script available at https://software.sandia.gov/trac/pyomo/downloader.  This post will review how to use this script, but also introduce another method for installing from trunk that uses the pip command.

Using pyomo_install:

To install from trunk using the pyomo_install script, one must execute a shell command such as the following:

$ python pyomo_install --trunk --venv pyomo_python

The --venv option in this command tells the install script to create a new python installation in a directory named pyomo_python.  If the installation was successful, the pyomo_python directory will contain a sub-directory named bin.  Inside bin there will be a new python executable along with other Pyomo commands.  The python executable inside this directory needs to be used when launching scripts that import Pyomo packages.  You might find it preferable to just make this your default python by adding this bin directory to the beginning of your PATH environment variable.  Be aware that installing trunk requires that the svn command (subversion) be available in your command shell.

Using pip:

On some systems, including Windows, you might run into issues with the above installation method.  A nice alternative to using the pyomo_install script is to use the Python-based package manager pip.  With more recent versions of Python, pip comes installed by default.  If you have an older version Python (some versions of 2.7 and earlier), you must first obtain pip by downloading and executing the get-pip.py script found at https://pip.pypa.io/en/stable/installing.  In addition to pip, the git command also needs to be available from your command shell.

Once the pip and git commands are available, installation of Pyomo trunk proceeds as follows:

  1. Install the master branch of PyUtilib from GitHub using pip:

    $ pip install git+https://github.com/PyUtilib/pyutilib

  2. Install the master branch of Pyomo from GitHub using pip:

    $ pip install git+https://github.com/Pyomo/pyomo

If in the future you ever need to remove Pyomo and Pyutilib, simply execute the command:

$ pip uninstall Pyomo Pyutilib

To update to a new Pyomo release, execute the command:

$ pip install -U Pyomo

If you are on Windows, the Pyomo installation process will create a sub-directory named 'Scripts' inside of the directory where Python is installed on your system.  Although your system Python will already be able to execute Pyomo scripts, the Scripts sub-directory will contain the other various Pyomo tools that you might find useful (such as the pyomo command).  Adding this directory to your PATH will make these tools available the next time you open a command shell.  The screenshot below shows how I edited my PATH environment variable on Windows 8 for a Python2.7 installation located in C:\Python27.

(Update: This post was edited after the git "pyomo" development branch of Pyutilib was permanently merged with the git master branch of Pyutilib)

(Update: This post was edited after Pyomo was moved onto GitHub)