OOF: Finite Element Analysis of Microstructures

Installing OOFCanvas Prerequisites

oof2 logo

[Linux] [Ubuntu] [Debian]
[Macintosh OS X] [MacPorts]

These are the instructions for installing the supporting software for OOFCanvas version 1.1.0 or later. If you are installing an earlier version, please see here. The instructions for installing OOFCanvas itself are in the OOFCanvas Manual.

The hardest part of installing OOFCanvas can be installing the third party libraries that it uses. This page contains explicit instructions for installing the requisite libraries on several different operating systems.

The easiest way to install the libraries that OOFCanvas requires is to use a package manager, which will automatically configure, build, and install the libraries and all of the additional software that the libraries require. The tricky bit can be knowing which packages to request. This page gives explicit instructions for using package managers on macOS and various flavors of Linux.

Only operating systems that we have access to are listed here. If you are using a system not listed here, if you send us e-mail we may be able to help. If you can update or add to these instructions, please let us know.

NOTE: These instructions assume that you are familiar with using Unix commands in a terminal window, and are a non-admin user but have sudo privileges. If you are doing this from an admin or root account (not recommended) you may be able to omit the sudo from many of the commands listed here.



Run the following commands by typing them in a terminal window:

          sudo apt install g++
          sudo apt install cmake-curses-gui
          sudo apt install swig
          sudo apt install pkg-config
          sudo apt install python3-dev
          sudo apt install libgtk-3-dev
          sudo apt install libcairomm-1.0-dev
          sudo apt install python-gi-dev 
If you want ImageMagick support, also run
        sudo apt install libmagick++-dev 
If you want NumPy and scikit-image support, also run
        sudo apt install python3-skimage 
(Tested on a minimal installation of Unbuntu 22.04.)


See Ubuntu. The same packages should work.


Commonly used package managers on macOS are are MacPorts, fink, and Homebrew. We have experience only with MacPorts. If you don't have a package manager installed already, it will be much easier to use MacPorts. If you do already have different package manager installed, please let us know what packages you needed to install for OOFCanvas, and we will list them here.

OOF2 can use either the native Mac graphics (Quartz) or the X11 graphics commonly used in Linux. To use X11, you will need to install an X11 server, which Apple no longer supplies, but which can be downloaded from Mac OS Forge. It's easier to get X11 from MacPorts, if you're using MacPorts. But note that OOF2 words better with Quartz than X11.

When the instructions below tell you to type a command, type it in a Terminal window. You can copy and paste the lines from this page.


  1. Install MacPorts from http://www.macports.org/install.php, following their instructions. It's easiest to use the pkg installer. If you get error messages when running sudo port -v selfupdate, open a new Terminal window and try again.

  2. If you want to use native Quartz graphics, you will need to ensure that all the ports that you install also use quartz. Edit the file /opt/local/etc/macports/variants.conf and add the line

                  -x11 +quartz 
    at the bottom.

  3. If you want to use X11 graphics instead of Quartz, don't edit variants.conf. Instead, install the X11 server by typing

                  sudo port install xorg-server 

  4. If you want the use the version of OOFCanvas that is currently available on MacPorts, just type

                  sudo port install oofcanvas
    to install it and all its prerequisites. You can discover the available version by running port info oofcanvas. You can choose which Python version to use by adding a variant:
                  sudo port install oofcanvas +python39
    will use Python 3.9, for example. The default Python is 3.11. By default ImageMagick support is turned on and Numpy support is turned off. You can reverse those options with the option -magick and +numpy.

  5. Install the OOFCanvas dependencies by typing

                  sudo port install cmake
                  sudo port install swig-python
                  sudo port install gtk3
                  sudo port install cairomm 
    Install the Python bindings for Gtk3 by installing the version of gobject3 for the version of Python that you want to use. You can use version 3.8 or later. In the following line, replace X by 8, 9, 10, or 11.
                  sudo port install py3X-gobject3 
    This will also install the selected version of Python, and when OOFCanvas is built, its Python modules will be installed in <prefix>/lib/python3.X/site-packages.

    If you want ImageMagick support, type

                  sudo port install imagemagick 
    If you want NumPy and scikit-image support, type
                  sudo port install py3X-scikit-image 
    using the same version of python you used for pyX-gobject3.

    (Tested on macOS 13.5 with MacPorts 2.8.1.)


Anaconda is a package manager for python programs that runs on a variety of systems. You can install and run OOFCanvas and OOF2 inside an Anaconda environment.

Not all of the OOFCanvas prerequisites can be simply installed via anaconda, and have to be compiled manually inside the anaconda environment. (In the instructions below, you may have to adjust the version numbers.)

  1. Create and activate a new Anaconda environment. We'll assume it's called OOF2.

                  conda create --name OOF2 python=3
                  conda activate OOF2 

  2. If you want ImageMagick support in OOFCanvas, download the .tar.gz file of the latest ImageMagick 6 Linux source from the Install ImageMagick from Source site.

    Follow the directions on that site to build ImageMagick, but tell it to install into your anaconda environment

                  tar -xf ImageMagick-6.9.12.tar.gz
                  cd ImageMagick-6.9.12
                  ./configure --prefix=$HOME/Anaconda3/envs/OOF2
                  make install 

  3. Download swig4 from the swig download site.

    Unpack the tar file:

                  tar -xf swig-4.1.1.tar.gz
                  cd swig-4.1.1
                  ./configure --prefix=$HOME/Anaconda3/envs/OOF2
                  make install 
  4. Install Anaconda packages

                  conda install -c conda-forge pycairo gtk3 pygobject
                  conda install -c conda-forge pango matplotlib 
    If you want NumPy and scikit-image support in OOFCanvas,
                  conda install -c conda-forge scikit-image