Set Up the Project
Concrete-ML is a Python
library, so Python
should be installed to develop Concrete-ML. v3.8
and v3.9
are the only supported versions. Concrete-ML also uses Poetry
and Make
.
First of all, you need to git clone
the project:
Some tests require files tracked by git-lfs to be downloaded. To do so, please follow the instructions on git-lfs website, then run git lfs pull
.
Automatic installation
A simple way to have everything installed is to use the development Docker (see the Docker setup guide). On Linux and macOS, you have to run the script in ./script/make_utils/setup_os_deps.sh
. Specify the --linux-install-python
flag if you want to install python3.8 as well on apt-enabled Linux distributions. The script should install everything you need for Docker and bare OS development (you can first review the content of the file to check what it will do).
For Windows users, the setup_os_deps.sh
script does not install dependencies because of how many different installation methods there are/lack of a single package manager.
The first step is to install Python (as some of the dev tools depend on it), then Poetry. In addition to installing Python, you are still going to need the following software available on path on Windows, as some of the basic dev tools depend on them:
Development on Windows only works with the Docker environment. Follow this link to setup the Docker environment.
Manual installation
Python
To manually install Python, you can follow this guide (alternatively, you can google how to install Python 3.8 (or 3.9)
).
Poetry
Poetry
is used as the package manager. It drastically simplifies dependency and environment management. You can follow this official guide to install it.
As there is no concrete-compiler
package for Windows, only the dev dependencies can be installed. This requires Poetry >= 1.2.
Make
The dev tools use make
to launch the various commands.
On Linux, you can install make
from your distribution's preferred package manager.
On macOS, you can install a more recent version of make
via brew:
It is possible to install gmake
as make
. Check this StackOverflow post for more info.
On Windows, check this GitHub gist.
In the following sections, be sure to use the proper make
tool for your system: make
, gmake
, or other.
Cloning the repository
To get the source code of Concrete-ML, clone the code repository using the link for your favourite communication protocol (ssh or https).
Setting up environment on your host OS
We are going to make use of virtual environments. This helps to keep the project isolated from other Python
projects in the system. The following commands will create a new virtual environment under the project directory and install dependencies to it.
The following command will not work on Windows if you don't have Poetry >= 1.2.
Activating the environment
Finally, activate the newly created environment using the following command:
macOS or Linux
Windows
Setting up environment on Docker
Docker automatically creates and sources a venv in ~/dev_venv/
The venv persists thanks to volumes. It also creates a volume for ~/.cache to speed up later reinstallations. You can check which Docker volumes exist with:
You can still run all make
commands inside Docker (to update the venv, for example). Be mindful of the current venv being used (the name in parentheses at the beginning of your command prompt).
Leaving the environment
After your work is done, you can simply run the following command to leave the environment:
Syncing environment with the latest changes
From time to time, new dependencies will be added to the project or the old ones will be removed. The command below will make sure the project has the proper environment, so run it regularly!
Troubleshooting your environment
in your OS
If you are having issues, consider using the dev Docker exclusively (unless you are working on OS-specific bug fixes or features).
Here are the steps you can take on your OS to try and fix issues:
At this point, you should consider using Docker as nobody will have the exact same setup as you. If, however, you need to develop on your OS directly, you can ask Zama for help.
in Docker
Here are the steps you can take in your Docker to try and fix issues:
If the problem persists at this point, you should ask for help. We're here and ready to assist!
Last updated