Installation guide

C++

pagmo has the following third-party dependencies:

  • Boost, mandatory, header-only

  • Eigen, optional, header-only (enabled via the PAGMO_WITH_EIGEN3 CMake option)

  • NLopt, optional, requires linking (enabled via the PAGMO_WITH_NLOPT CMake option)

  • Ipopt, optional, requires linking (enabled via the PAGMO_WITH_IPOPT CMake option)

Installation from source

After making sure the dependencies above are installed in your system, you can download the pagmo source code from the GitHub release page. Alternatively, and if you like living on the bleeding edge, you can get the very latest version of pagmo via the git command:

git clone https://github.com/esa/pagmo2.git

Once you are in pagmo’s source tree, you must configure your build using cmake. This will allow you to enable support for optional dependencies, configure the install destination, etc. For example,

cmake -DCMAKE_INSTALL_PREFIX=~/.local .

The headers will be installed in the CMAKE_INSTALL_PREFIX/include directory. When done, you can install pagmo via the command:

make install

To check that all went well compile the quick-start example.

Installation with conda

pagmo is also available via the conda package manager for Linux, OSX and Windows. In order to install pagmo via conda, you just need to add conda-forge to the channels, and then we can immediately install pagmo:

conda config --add channels conda-forge
conda install pagmo

Please refer to the conda documentation for instructions on how to setup and manage your conda installation.

Installation on Arch Linux

Pagmo is also available on the Arch User Repository (AUR) in Arch Linux. It is recommended to use an AUR helper like yay or pikaur for ease of installation. See the AUR helpers page on the Arch Linux wiki for more info.

Note: To install pagmo with optional dependency support like nlopt or ipopt, make sure to install the optional dependencies before installing the pagmo package.

Install optional dependencies:

yay -S coin-or-ipopt eigen nlopt

Install pagmo:

yay -S pagmo

Installation on FreeBSD

A FreeBSD port via pkg has been created for pagmo. In order to install pagmo using pkg, execute the following command:

pkg install pagmo2

Installation with homebrew

A Homebrew recipe for pagmo has been generously contributed by the community. In order to install pagmo on OSX with Homebrew, it is sufficient to execute the following command:

brew install pagmo

Python

The Python module corresponding to pagmo is called pygmo. pygmo has two mandatory runtime Python dependencies:

  • NumPy, the standard Python array library

  • cloudpickle, a package that extends Python’s serialization capabilities.

There are various options for the installation of pygmo:

The following table summarizes the pros and cons of the various installation methods:

Method

Linux Py 2.7

Linux Py 3.x

OSX Py 2.7

OSX Py 3.x

Win Py 2.7

Win Py 3.x

conda

64bit

64bit

64bit

64bit

64bit

pip

64bit

64bit

64bit (MinGW)

64bit (MinGW)

source

32/64bit

32/64bit

32/64bit

32/64bit

32/64bit (MinGW)

32/64bit

In general, we recommend the use of conda: in addition to making the installation of pygmo easy, it also provides user-friendly access to a wealth of packages from the scientific Python ecosystem. Conda is a good default choice in Linux and OSX.

In Windows, the situation is a bit more complicated. The first issue is that the compiler used by conda for Python 2.7 is too old to compile pygmo, and thus we cannot provide conda packages for Python 2.7 (however, we do provide conda packages for Python 3.x). The second issue is that the Windows platform lacks a free Fortran compiler that can interoperate with Visual C++ (the compiler used by conda on Windows). Thus, the pygmo packages for conda on Windows might lack some Fortran-based features available on Linux and OSX (e.g., the wrapper for the Ipopt solver).

Thus, in order to provide a better experience to our Windows users, we publish pip packages for pygmo built with MinGW. These packages allow us both to support Python 2.7 and to provide a full-featured pygmo on Windows, thanks to the gfortran compiler. The pip packages are also available on Linux for those users who might prefer pip to conda, but they are not available on OSX.

Finally, it is always possible to compile pygmo from source. This is the most flexible and powerful option, but of course also the least user-friendly.

Note

As a general policy, we are committed to providing packages for Python 2.7 and for the latest two versions of Python 3.x.

Installation with conda

The installation of pygmo with conda is straightforward. We just need to add conda-forge to the channels, and then we can immediately install pygmo:

conda config --add channels conda-forge
conda install pygmo

conda will automatically install all of pygmo’s dependencies for you. Please refer to the conda documentation for instructions on how to setup and manage your conda installation.

Installation with pip

The installation of pygmo with pip is also straightforward:

pip install pygmo

Like conda, also pip will automatically install all of pygmo’s dependencies for you. If you want to install pygmo for a single user instead of system-wide, which is in general a good idea, you can do:

pip install --user pygmo

Installation from source

For an installation from source, pygmo has the following dependencies:

  • pagmo (i.e., the C++ headers of the pagmo library need to be installed before attempting to compile pygmo),

  • Boost.Python

  • NumPy (note that NumPy’s development headers must be installed as well).

Note that, at the present time, the versions of pygmo and pagmo must be exactly identical for the compilation of pygmo to be successful, otherwise the build process will error out. If you are updating pagmo/pygmo to a later version, make sure to install the new pagmo version before compiling the new pygmo version.

To build the module from source you need to activate the PAGMO_BUILD_PYGMO cmake option and deactivate the PAGMO_BUILD_PAGMO option. Check carefully what Python version and what libraries/include paths are detected (in particular, on systems with multiple Python versions it can happen that CMake detects the headers from a Python version and the Python library from another version). The CMAKE_INSTALL_PREFIX variable will be used to construct the final location of headers and Python module after install.

When done, type (in your build directory):

make install

To check that all went well fire-up your Python console and try the example in quick-start example.