Skip to content

Installing from source

Paul Kuberry edited this page Sep 19, 2025 · 5 revisions

Installing pycompadre from source

Using pip locally

After cloning the repo, run

>> pip install . -v

or, if you wish to be more specific about which Python you are installing into,

>> python3 -m pip install . -v

Similar to instructions for adding non-standard CMake arguments, you can run

>> CMAKE_CONFIG_FILE=example_file.txt pip install . -v

or, if you wish to be more specific about which Python you are installing into,

>> CMAKE_CONFIG_FILE=example_file.txt python3 -m pip install . -v

If you are installing with pip install pycompadre (getting the source code from pypi.org), then you can create a file cmake_opts.txt in your current working directory and then execute

CMAKE_CONFIG_FILE=`pwd`/cmake_opts.txt pip install pycompadre

The pwd is present in the command because an absolute path is required for CMAKE_CONFIG_FILE.

Note: It is no longer recommended to do python setup.py install, as pycompadre has moved to a pyproject.toml style setup, with setup.py only remaining to provide functionality for configuring and building with CMake. Additionally, this also isn't recommended because it won't keep track of installed files, so uninstalling will have to be done manually by locating files and removing them.

Building with CMake

After following instructions for building the Compadre Toolkit, we just modify the script used by one line:

For instance, in "script_you_choose.sh", we change or add the following CMake variables:

-D Compadre_USE_PYTHON:BOOL=ON \

to enable the Python interface to the toolkit and optionally,

-D Compadre_USE_MATLAB:BOOL=ON \

to enable to the Matlab examples.

Python must be enabled in order to use the Matlab tests and install scripts. There is no interface from Matlab directly to the C++ code. This only takes place through the Python interface.

The CMake build system will attempt to determine which Python executable you are using. If you would like to specify a particular version of Python, set the CMake variable:

-D PYTHON_EXECUTABLE:FILEPATH='path/to/your/python' \

Otherwise, which python will be called and whatever is returned will be used.

Notes: The Matlab examples require at least Matlab version 2017a.

Clone this wiki locally