Skip to content

Running Cura from Source

Erwan MATHIEU edited this page Dec 10, 2024 · 41 revisions

System requirements

Make sure that the binaries for the system dependencies can be found on the PATH

Windows

  • Windows 10 or higher
  • Visual Studio with MSVC 2022 or higher
  • Python 3.12 or higher
  • venv (Python)
  • sip (Python) 6.5.1
  • CMake 3.23 or higher
  • Ninja 1.10 or higher
  • Conan >=2.7.0 <3.0.0

Executing from the Powershell is preferred. To be completely safe, start powershell inside of the x64 Native Command Tools Prompt.

macOS

We recommend using brew to install these dependencies.

  • macOS 11 or higher
  • xcode 12 or higher
  • apple-clang-12.0 or higher
  • Python 3.12 or higher
  • venv (Python)
  • sip (Python) 6.5.0 or higher
  • altool
  • automake
  • CMake 3.23 or higher
  • Ninja 1.10 or higher
  • Conan >=2.7.0 <3.0.0

Linux

  • Ubuntu/Debian/Arch/Manjaro (glibc 2.28 or higher)
  • gcc-13 or higher
  • Python 3.12 or higher
  • venv (Python)
  • sip (Python) 6.5.0 or higher
  • CMake 3.23 or higher
  • Ninja 1.10 or higher
  • Conan >=2.7.0 <3.0.0
  • autoreconf
  • ( xtrans )

Installation

1. Configure Conan

  1. First we will create a Python virtual environment (venv) so that your work with Cura will not mess up with the rest of the system. You could skip this, but e.g. on Ubuntu 24.04 this is almost mandatory.
python -m venv cura_venv
  1. Now activate this new venv
  • On Linux/MacOS
source cura_venv/bin/activate
  • On Windows
cura_venv\Scripts\activate.ps1
  1. Finally, install and setup conan inside the venv
pip install conan==2.7.0
conan config install https://github.com/ultimaker/conan-config.git
conan profile detect --force

2. Clone Cura

Clone Cura and enter the Cura root directory.

git clone https://github.com/Ultimaker/Cura.git 
cd Cura

3. Initialize the Development Environment

We will now use conan to install the required dependencies for the development environment. The following command should be executed in the root directory of the Cura repository:

conan install . --build=missing --update -g VirtualPythonEnv

Now let's see what this does:

  • conan install . is the basic command to install the dependencies for the recipe (conanfile.py) present in the current directory
  • --build=missing build dependencies for which there is no remote pre-built binary package (which is very likely)
  • --update download the most recent versions of recipes for each dependency (you may skip it next time, it will be faster)
  • -g VirtualPythonEnv run a specific "generator" that will create a fully-preconfigured Python environment for you to run Cura

You can also use a few extra options:

  • -g PyCharmRunEnv if you use PyCharm, this will create appropriate run/debug/test configurations. You must click Add Configuration..., and click Apply for these to be displayed.
  • -c user.generator.virtual_python_env:dev_tools=True will install extra dev tools in the Python environment, like pytest

The generated files you will need are placed in a new build/generators folder. You can safely delete this file later to re-create the environment.

If you get an error like ERROR: while executing system_requirements(): Aborted due to CONAN_SYSREQUIRES_MODE=verify. Some system packages need to be installed you need to install the required system packages.

4. Using the Cura Python virtual environment

During the conan install, the VirtualPythonEnv generator has created a new Python virtual environment, different from the first one:

  • It uses the CPython interpreter built/installed as a conan dependency
  • It contains python packages that are the direct dependencies of Cura (e.g. Uranium, pyArcus, ...)
  • It contains third-party packages that are necessary to run Cura (e.g. PyQt, pyserial, ...)

This environment is located in build/generators/cura_venv. You can activate it by executing the following command in the root directory of the Cura repository:

  • On Linux/MacOS
source build/generators/virtual_python_env.sh
  • On Windows
build/generators/virtual_python_env.ps1

ℹ️ Note on the execution virtual environment

If you want more control over the execution virtual environment, you can also do something like:

source build/generators/conanrun.sh # Will set environment variables to link to conan dependencies
python -m venv cura_run_venv        # Manually create the virtual environment using the proper CPython interpreter
source cura_run_venv/bin/activate   # Activate the virtual environment

After that, you can install the third-party dependencies manually, by using the generated requirements files in build/generators/:

ls build/generators/pip_requirements_{core,dev}_*.txt | xargs -I {} pip install -r {}

Or select specifically which set of packages you want to install:

pip install -r build/generators/pip_requirements_core_basic.txt
pip install -r build/generators/pip_requirements_core_hashes.txt

5. Run Cura

Now you have all the dependencies setup, you should be able to run cura:

python cura_app.py
Clone this wiki locally