Skip to content

Build on Linux and macOS

The module from source, with monero-project and monero-cpp, for the Python of the system or of an environment.

  1. Clone the project repository:
    git clone --recurse-submodules https://github.com/libmonero/monero-python.git
    
  2. Install the build dependencies, on Ubuntu and Debian with the script that CI uses (the packages of apt for monero-project, monero-cpp and the module, and python3-venv for the virtual environment of the tests):
    cd monero-python
    ./bin/install_dependencies_linux.sh
    
    On other systems, follow the instructions of monero-cpp.
  3. Build monero-project and the monero-cpp submodule (located at ./external/monero-cpp): ./bin/build_monero_cpp.sh. It runs 3 jobs, a compiler of monero takes up to 1.5 GB of memory: set JOBS for more or fewer.
  4. Build monero-python to ./build/:
    mkdir -p build
    cd build
    cmake ..
    make
    
  5. Or build and install monero-python with pip:
    pip3 install . --break-system-packages
    
  6. Or run build script: ./bin/build_libmonero_python.sh

VS Code: the repository has tasks to build, test and lint, launch configurations to debug the tests in Python and in C++, and to build and serve the docs: VS Code.

Faster rebuilds: if ccache is installed it is used automatically for monero and monero-python (pass -DUSE_CCACHE=OFF to cmake to disable it). To use it for monero-cpp as well, build that with -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache.