
Kar Chun Tan
Creator
Metadata
Resolving pycairo Build Errors Due to Missing C Compiler on Ubuntu
Recently, I encountered an issue while installing Manim by running uv add manim
in my terminal. The installation process failed with an error message indicating that pycairo
could not be built because a C compiler was not found.
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)
[stdout]
+ meson setup /home/karchunt/.cache/uv/sdists-v9/pypi/pycairo/1.28.0/QB4rCO5e9gNgbsUODdHut/src
/home/karchunt/.cache/uv/sdists-v9/pypi/pycairo/1.28.0/QB4rCO5e9gNgbsUODdHut/src/.mesonpy-bacl643f
-Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dwheel=true -Dtests=false
--native-file=/home/karchunt/.cache/uv/sdists-v9/pypi/pycairo/1.28.0/QB4rCO5e9gNgbsUODdHut/src/.mesonpy-bacl643f/meson-python-native-file.ini
The Meson build system
Version: 1.8.4
Source dir: /home/karchunt/.cache/uv/sdists-v9/pypi/pycairo/1.28.0/QB4rCO5e9gNgbsUODdHut/src
Build dir: /home/karchunt/.cache/uv/sdists-v9/pypi/pycairo/1.28.0/QB4rCO5e9gNgbsUODdHut/src/.mesonpy-bacl643f
Build type: native build
Project name: pycairo
Project version: 1.28.0
../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'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"
A full log can be found at
/home/karchunt/.cache/uv/sdists-v9/pypi/pycairo/1.28.0/QB4rCO5e9gNgbsUODdHut/src/.mesonpy-bacl643f/meson-logs/meson-log.txt
hint: This usually indicates a problem with the package or the build environment.
help: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and
syncing.
The error means you’re missing a C compiler (like) gcc
or clang
on your system, which is required to build certain Python packages like pycairo
(a dependency of Manim).
To resolve this issue on Ubuntu, you can install the necessary build tools by running the following command in your terminal:
sudo apt update
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev
Then try installing Manim again:
uv add manim
This should resolve the pycairo
build error and allow you to successfully install Manim.
Last updated on