error: could not build wheels for pycairo, which is required to install pyproject.toml-based projects

  • Last Update :
  • Techknowledgy :
1._
apt - get install sox ffmpeg libcairo2 libcairo2 - dev
apt - get install texlive - full
pip3 install manimlib # or pip install manimlib

Then:

pip3 install manimce # or pip install manimce

I had the same error, for a different package however. I solved the issue with:

apt install libpython3 .9 - dev

In my case I'm trying to install PyGObject in Fedora.
But I experience the same problem.
Here's how to do it in Fedora.

sudo dnf install gobject - introspection - devel cairo - gobject - devel

follow by installing the lib that you're using, in my case was PyGObject

pip install PyGObject

Suggestion : 2

when I do python3.9 -m pip install pycairo,Recommendation: Keep different things separate. Have only one system manage files in system directories: dnf Keep everything else in user directories.,I managed to /home/linuxbrew/.linuxbrew/opt/python@3.9/bin/python3.9 -m pip install seewav,When we’ll get the PCS package that will support Python3.9 in Almalinux-8. we are updating python3.6 to 3.9 as “3.6” is already deprecated.

I checked the requirement there Getting Started — Pycairo documentation

dnf--enablerepo = * install cairo - devel pkg - config python3 - devel
Last metadata expiration check: 0: 00: 35 ago on Thu 28 Oct 2021 06: 56: 44 PM EDT.
Package cairo - devel - 1.15 .12 - 3. el8.x86_64 is already installed.
Package pkgconf - pkg - config - 1.4 .2 - 1. el8.x86_64 is already installed.
Package python36 - devel - 3.6 .8 - 2. module_el8 .3 .0 + 6191 + 6 b4b10ec.x86_64 is already installed.
command: /usr/bin / python3 .9 / usr / local / lib / python3 .9 / site - packages...
fatal error: Python.h: No such file or directory
1._
command: /usr/bin / python3 .9 / usr / local / lib / python3 .9 / site - packages...
2._
fatal error: Python.h: No such file or directory

Who has Python.h?

dnf provides * /Python.h

dnf provides */Python.h | grep 3.9

python39 - devel - 3.9 .2 - 1. module_el8 .4 .0 + 2374 + 27 ce8e03.x86_64: Libraries and header files needed
for Python development
Filename: /usr/include / python3 .9 / Python.h
python39-devel-3.9.2-1.module_el8.4.0+2374+27ce8e03.x86_64 : Libraries and header files needed for Python development
Filename    : /usr/include/python3.9/Python.h
ERROR: Command errored out with exit status 1:
   command: /usr/bin / python - u - c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '
"'"
'/tmp/pip-install-4muu1mlp/gpg_5f1b2d644c2e48feae375007df49b024/setup.py'
"'"
'; __file__='
"'"
'/tmp/pip-install-4muu1mlp/gpg_5f1b2d644c2e48feae375007df49b024/setup.py'
"'"
';f = getattr(tokenize, '
"'"
'open'
"'"
', open)(__file__) if os.path.exists(__file__) else io.StringIO('
"'"
'from setuptools import setup; setup()'
"'"
');code = f.read().replace('
"'"
'\r\n'
"'"
', '
"'"
'\n'
"'"
');f.close();exec(compile(code, __file__, '
"'"
'exec'
"'"
'))'
install--record / tmp / pip - record - mntz902v / install - record.txt--single - version - externally - managed--user--prefix = --compile--install - headers / home / stubfeed / .local / include / python3 .9 / gpg
cwd: /tmp/pip - install - 4 muu1mlp / gpg_5f1b2d644c2e48feae375007df49b024 /
   Complete output(9 lines):
   running install
running build
Using gpgme.h from / usr / include / gpgme.h
running build_ext
building 'gpg._gpgme'
extension
swigging build / gpgme.i to build / gpgme_wrap.c
swig - python - threads - py3 - Ibuild - outdir build / lib.linux - x86_64 - 3.9 / gpg - o build / gpgme_wrap.c build / gpgme.i
build / gpgme.h: 16: Error: CPP #error ""
unexpected value
for __WORDSIZE macro "".Use the - cpperraswarn option to
continue swig processing.
error: command '/usr/bin/swig'
failed with exit code 1
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
ERROR: Command errored out with exit status 1: /usr/bin / python - u - c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '
"'"
'/tmp/pip-install-4muu1mlp/gpg_5f1b2d644c2e48feae375007df49b024/setup.py'
"'"
'; __file__='
"'"
'/tmp/pip-install-4muu1mlp/gpg_5f1b2d644c2e48feae375007df49b024/setup.py'
"'"
';f = getattr(tokenize, '
"'"
'open'
"'"
', open)(__file__) if os.path.exists(__file__) else io.StringIO('
"'"
'from setuptools import setup; setup()'
"'"
');code = f.read().replace('
"'"
'\r\n'
"'"
', '
"'"
'\n'
"'"
');f.close();exec(compile(code, __file__, '
"'"
'exec'
"'"
'))'
install--record / tmp / pip - record - mntz902v / install - record.txt--single - version - externally - managed--user--prefix = --compile--install - headers / home / stubfeed / .local / include / python3 .9 / gpg Check the logs
for full command output.

I was able to install pycairo without any issues on the latest EL8 release:

[cairo @cairotest~] $ dnf - y install cairo - devel pkg - config python39 python39 - devel python39 - pip[cairo @cairotest~] $ dnf - y groupinstall 'Development Tools'

[cairo @cairotest~] $ python3 .9 - m pip install pycairo
Defaulting to user installation because normal site - packages is not writeable
Collecting pycairo
Using cached pycairo - 1.20 .1.tar.gz(344 kB)
Installing build dependencies...done
Getting requirements to build wheel...done
Preparing wheel metadata...done
Building wheels
for collected packages: pycairo
Building wheel
for pycairo(PEP 517)...done
Created wheel
for pycairo: filename = pycairo - 1.20 .1 - cp39 - cp39 - linux_x86_64.whl size = 283952 sha256 = 66028 c4de1292b5ccb2c3cd5af7e898e57a6a1cdb6faa030577a720de909e86c
Stored in directory: /home/cairo / .cache / pip / wheels / 29 / a9 / b9 / 15e3 dc25ce0db1d40546014674ee0cac132f94bf3a9607d02b
Successfully built pycairo
Installing collected packages: pycairo
Successfully installed pycairo - 1.20 .1

Suggestion : 3

ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects

Run 

apt - get install sox ffmpeg libcairo2 libcairo2 - dev
apt - get install texlive - full
pip3 install manimlib

Then

pip3 install manimce

Suggestion : 4

ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects,Please briefly explain why you feel this question should be reported.,Please briefly explain why you feel this answer should be reported.,Please briefly explain why you feel this user should be reported.

Run

apt - get install sox ffmpeg libcairo2 libcairo2 - dev
apt - get install texlive - full
pip3 install manimlib # or pip install manimlib

Then:

pip3 install manimce