Skip to main content

Resolving pycairo Build Errors Due to Missing C Compiler on Ubuntu

When installing Manim with uv add manim, the process may fail with an error indicating that pycairo could not be built because no C compiler was found.

Error Output

karchunt@kcserver:~/Desktop/docs$ uv add manim
Resolved 79 packages in 2.60s
      Built srt==3.5.3
  × Failed to build `pycairo==1.28.0`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `mesonpy.build_wheel` failed (exit status: 1)

      ../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
      The following exception(s) were encountered:
      Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
      Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
      Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"

      hint: This usually indicates a problem with the package or the build environment.

Root Cause

The error means your system is missing a C compiler (gcc or clang), which is required to compile pycairo — a native dependency of Manim.

Fix

1
Install the required build tools
2
sudo apt update
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev
3
build-essential pulls in gcc, make, and other essential compilation tools. libcairo2-dev and libpango1.0-dev provide the native libraries that pycairo and Manim depend on.
4
Retry the Manim installation
5
uv add manim

Build docs developers (and LLMs) love