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

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

安装 manimce 时出错,我一直在尝试在 windows 子系统上为 linux 和 运行

安装 manimce 库
pip install manimce
Collecting manimce
  Downloading manimce-0.1.1.post2-py3-none-any.whl (249 kB)
     |████████████████████████████████| 249 kB 257 kB/s
Collecting Pillow
  Using cached Pillow-8.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
Collecting scipy
  Using cached scipy-1.7.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (39.3 MB)
Collecting colour
  Using cached colour-0.1.5-py2.py3-none-any.whl (23 kB)
Collecting pangocairocffi<0.5.0,>=0.4.0
  Downloading pangocairocffi-0.4.0.tar.gz (17 kB)
  Preparing metadata (setup.py) ... done
Collecting numpy
  Using cached numpy-1.21.5-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
Collecting pydub
  Using cached pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Collecting pygments
  Using cached Pygments-2.10.0-py3-none-any.whl (1.0 MB)
Collecting cairocffi<2.0.0,>=1.1.0
  Downloading cairocffi-1.3.0.tar.gz (88 kB)
     |████████████████████████████████| 88 kB 160 kB/s
  Preparing metadata (setup.py) ... done
Collecting tqdm
  Using cached tqdm-4.62.3-py2.py3-none-any.whl (76 kB)
Collecting pangocffi<0.9.0,>=0.8.0
  Downloading pangocffi-0.8.0.tar.gz (33 kB)
  Preparing metadata (setup.py) ... done
Collecting pycairo<2.0,>=1.19
  Using cached pycairo-1.20.1.tar.gz (344 kB)

  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting progressbar
  Downloading progressbar-2.5.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Collecting rich<7.0,>=6.0
  Using cached rich-6.2.0-py3-none-any.whl (150 kB)
Collecting cffi>=1.1.0
  Using cached cffi-1.15.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (446 kB)
Collecting commonmark<0.10.0,>=0.9.0
  Using cached commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
Collecting typing-extensions<4.0.0,>=3.7.4
  Using cached typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
Collecting colorama<0.5.0,>=0.4.0
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: cairocffi, pangocairocffi, pangocffi, pycairo, progressbar
  Building wheel for cairocffi (setup.py) ... done
  Created wheel for cairocffi: filename=cairocffi-1.3.0-py3-none-any.whl size=89650 sha256=afc73218cc9fa1d844d7165f598e2be0428598166b4c3ed9de5bbdc94a0a6977
  Stored in directory: /home/yusifer_zendric/.cache/pip/wheels/f3/97/83/8022b9237866102e18d1b7ac0a269769e6fccba0f63dceb9b7
  Building wheel for pangocairocffi (setup.py) ... done
  Created wheel for pangocairocffi: filename=pangocairocffi-0.4.0-py3-none-any.whl size=19283 sha256=54399796259c6e24f9ab56c5747ab273dcf97fb6fed3e7b54935f9ac49351d50
  Stored in directory: /home/yusifer_zendric/.cache/pip/wheels/60/58/92/507a12a5044f7fcda6f4dfd8e0a607cc1fe957bc0dea885906
  Building wheel for pangocffi (setup.py) ... done
  Created wheel for pangocffi: filename=pangocffi-0.8.0-py3-none-any.whl size=37899 sha256=bea348af93696816b046dd901aa60d29a464460c5faac67628eb7e1ea7d1807d
  Stored in directory: /home/yusifer_zendric/.cache/pip/wheels/c4/df/6d/e9d0f79b1545f6e902cc22773b1429de7a5efc240b891ee009
  Building wheel for pycairo (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/yusifer_zendric/manim_ce/venv/bin/python /home/yusifer_zendric/manim_ce/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpuguwzu3u
       cwd: /tmp/pip-install-l4hqdegr/pycairo_f4d80b8f3e4840a3802342825adcdff5
  Complete output (12 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/cairo
  copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
  copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
  copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
  running build_ext
  'pkg-config' not found.
  Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']
  ----------------------------------------
  ERROR: Failed building wheel for pycairo
  Building wheel for progressbar (setup.py) ... done
  Created wheel for progressbar: filename=progressbar-2.5-py3-none-any.whl size=12074 sha256=7290ef8de5dd955bf756b90130f400dd19c2cc9ea050a5a1dce2803440f581e2
  Stored in directory: /home/yusifer_zendric/.cache/pip/wheels/2c/67/ed/d84123843c937d7e7f5ba88a270d11036473144143355e2747
Successfully built cairocffi pangocairocffi pangocffi progressbar
Failed to build pycairo
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
(venv) yusifer_zendric@Laptop-Yusifer:~/manim_ce$
(venv) yusifer_zendric@Laptop-Yusifer:~/manim_ce$ pip install manim_ce
ERROR: Could not find a version that satisfies the requirement manim_ce (from versions: none)
ERROR: No matching distribution found for manim_ce
(venv) yusifer_zendric@Laptop-Yusifer:~/manim_ce$ manim example_scenes/basic.py -pql

Command 'manim' not found, did you mean:

  command 'maim' from deb maim (5.5.3-1build1)

Try: sudo apt install <deb name>

(venv) yusifer_zendric@Laptop-Yusifer:~/manim_ce$ sudo apt-get install manim
[sudo] password for yusifer_zendric:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package manim
(venv) yusifer_zendric@Laptop-Yusifer:~/manim_ce$ pip3 install manimlib
Collecting manimlib
  Downloading manimlib-0.2.0.tar.gz (4.8 MB)
     |████████████████████████████████| 4.8 MB 498 kB/s
  Preparing metadata (setup.py) ... done
Collecting Pillow
  Using cached Pillow-8.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
Collecting argparse
  Downloading argparse-1.4.0-py2.py3-none-any.whl (23 kB)
Collecting colour
  Using cached colour-0.1.5-py2.py3-none-any.whl (23 kB)
Collecting numpy
  Using cached numpy-1.21.5-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
Collecting opencv-python
  Downloading opencv_python-4.5.4.60-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (60.3 MB)
     |████████████████████████████████| 60.3 MB 520 kB/s
Collecting progressbar
  Using cached progressbar-2.5-py3-none-any.whl
Collecting pycairo
  Using cached pycairo-1.20.1.tar.gz (344 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pydub
  Using cached pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Collecting pygments
  Using cached Pygments-2.10.0-py3-none-any.whl (1.0 MB)
Collecting scipy
  Using cached scipy-1.7.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (39.3 MB)
Collecting tqdm
  Using cached tqdm-4.62.3-py2.py3-none-any.whl (76 kB)
Building wheels for collected packages: manimlib, pycairo
  Building wheel for manimlib (setup.py) ... done
  Created wheel for manimlib: filename=manimlib-0.2.0-py3-none-any.whl size=212737 sha256=27efe2c226d80cfe5663928e980d3e5f5a164d8e9d0aacea5014d37ffdedb76a
  Stored in directory: /home/yusifer_zendric/.cache/pip/wheels/87/36/c1/2db5ed5de9908034108f3c39538cd3367445d9cec01e7c8c23
  Building wheel for pycairo (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/yusifer_zendric/manim_ce/venv/bin/python /home/yusifer_zendric/manim_ce/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp5o2970su
       cwd: /tmp/pip-install-sxxp3lw2/pycairo_d372a62d0c6b4c4484391402d21485e1
  Complete output (12 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/cairo
  copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
  copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
  copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
  running build_ext
  'pkg-config' not found.
  Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']
  ----------------------------------------
  ERROR: Failed building wheel for pycairo
Successfully built manimlib
Failed to build pycairo
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects

所有安装的库都接受 pycairo 库。它只是显示此安装 pyproject.toml 错误。事实上,我已经完成了 pip install pyproject.toml 并安装了它,然后它也显示了同样的错误。

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

然后:

pip3 install manimce  # or pip install manimce

一切正常。

第 1 步:尝试:pip install wheel 第 2 步:pip install manimce

如果仍然无效,请尝试:pip3 而不是 pip

否则:重新安装 python 并执行步骤 1 和步骤 2

如果还是不行安装低版本 如果它仍然不起作用,请确保它是正确的包 如果它仍然不起作用,则某处出现了一些致命错误

我有同样的错误,但是对于不同的包。我解决了这个问题:

apt install libpython3.9-dev

就我而言,我正在尝试在 Fedora 中安装 PyGObject
但是我遇到了同样的问题。
以下是 Fedora.

中的操作方法
sudo dnf install gobject-introspection-devel cairo-gobject-devel

然后安装您正在使用的库,在我的例子中是 PyGObject

pip install PyGObject