Installation
Linux/MacOS
Prerequisites
git
Python 3.11 or higher
Clone the repository and recursively update submodules:
git clone git@github.com:leap-c/leap-c.git leap_c
cd leap_c
git submodule update --init --recursive
Python
We work with Python 3.11. If it is not already installed on your system, you can obtain it using deadsnakes:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11
A virtual environment is recommended. For example, to create a virtual environment called .venv
and activate it, run:
pip3 install virtualenv
virtualenv --python=/usr/bin/python3.11 .venv
source .venv/bin/activate
The following steps assume that the virtual environment is activated.
CasADi
Install CasADi by running:
pip install casadi
acados
Then change into the acados directory
cd external/acados
and build it as described in the acados documentation. When running the
cmake
command, make sure to include the options -DACADOS_WITH_OPENMP=ON
, -DACADOS_PYTHON=ON
and -DACADOS_NUM_THREADS=1
.
PyTorch
Install PyTorch as described on the PyTorch website.
To install CPU-only PyTorch you can use:
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
Install leap-c
To install the package in the root directory of the repository, run:
pip install -e .
For development, you might want to install additional dependencies:
pip install -e .[dev]
See the pyproject.toml for more information on the installed packages.
Testing
To run the tests, use:
pytest tests -vv -s