ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
26.86k stars 1.84k forks source link

cmanimpango fatal error: Python.h #3769

Closed pterusgithub closed 6 months ago

pterusgithub commented 6 months ago

Preliminaries

Description of error

I've tried to install manimgl on ubuntu 22.04.4 LTS

sudo apt update
sudo apt upgrade
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev ffmpeg
sudo apt install texlive texlive-latex-extra
pip3 install manim

but I've got this error (no file or directory):

/tmp/pip-install-jjpnups8/manimpango_7d3957f25eea4f24960187125aae3f3f/manimpango/cmanimpango.c:83:10: fatal error: Python.h: Aucun fichier ou dossier de ce nom
         83 | #include "Python.h"

Installation logs

$ pip3 install manim
Defaulting to user installation because normal site-packages is not writeable
Collecting manim
  Using cached manim-0.18.1-py3-none-any.whl.metadata (10 kB)
Collecting Pillow>=9.1 (from manim)
  Using cached pillow-10.3.0-cp311-cp311-manylinux_2_28_x86_64.whl.metadata (9.2 kB)
Collecting Pygments>=2.0.0 (from manim)
  Using cached pygments-2.18.0-py3-none-any.whl.metadata (2.5 kB)
Requirement already satisfied: click>=8.0 in ./.local/lib/python3.11/site-packages (from manim) (8.1.7)
Collecting cloup>=2.0.0 (from manim)
  Using cached cloup-3.0.5-py2.py3-none-any.whl.metadata (6.7 kB)
Collecting decorator>=4.3.2 (from manim)
  Using cached decorator-5.1.1-py3-none-any.whl.metadata (4.0 kB)
Collecting isosurfaces>=0.1.0 (from manim)
  Using cached isosurfaces-0.1.2-py3-none-any.whl.metadata (3.3 kB)
Collecting manimpango<1.0.0,>=0.5.0 (from manim)
  Using cached ManimPango-0.5.0.tar.gz (4.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting mapbox-earcut>=1.0.0 (from manim)
  Using cached mapbox_earcut-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.0 kB)
Collecting moderngl<6.0.0,>=5.0.0 (from manim)
  Using cached moderngl-5.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.2 kB)
Collecting moderngl-window>=2.0.0 (from manim)
  Using cached moderngl_window-2.4.6-py3-none-any.whl.metadata (8.8 kB)
Collecting networkx>=2.6 (from manim)
  Using cached networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting numpy>=1.26 (from manim)
  Using cached numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
Collecting pycairo<2.0.0,>=1.13 (from manim)
  Using cached pycairo-1.26.0.tar.gz (346 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pydub>=0.20.0 (from manim)
  Using cached pydub-0.25.1-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting rich>=12.0.0 (from manim)
  Using cached rich-13.7.1-py3-none-any.whl.metadata (18 kB)
Collecting scipy>=1.6.0 (from manim)
  Using cached scipy-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Collecting screeninfo>=0.7 (from manim)
  Using cached screeninfo-0.8.1-py3-none-any.whl.metadata (2.9 kB)
Collecting skia-pathops>=0.7.0 (from manim)
  Using cached skia_pathops-0.8.0.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.3 kB)
Collecting srt>=3.0.0 (from manim)
  Using cached srt-3.5.3-py3-none-any.whl
Collecting svgelements>=1.8.0 (from manim)
  Using cached svgelements-1.9.6-py2.py3-none-any.whl.metadata (44 kB)
Collecting tqdm>=4.0.0 (from manim)
  Using cached tqdm-4.66.4-py3-none-any.whl.metadata (57 kB)
Collecting typing-extensions>=4.0.0 (from manim)
  Using cached typing_extensions-4.11.0-py3-none-any.whl.metadata (3.0 kB)
Collecting watchdog>=2.0.0 (from manim)
  Using cached watchdog-4.0.0-py3-none-manylinux2014_x86_64.whl.metadata (37 kB)
Collecting glcontext<3,>=2.5.0 (from moderngl<6.0.0,>=5.0.0->manim)
  Using cached glcontext-2.5.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.1 kB)
Collecting pyglet>=2.0.0 (from moderngl-window>=2.0.0->manim)
  Using cached pyglet-2.0.15-py3-none-any.whl.metadata (7.8 kB)
Collecting pyrr<1,>=0.10.3 (from moderngl-window>=2.0.0->manim)
  Using cached pyrr-0.10.3-py3-none-any.whl.metadata (832 bytes)
Collecting markdown-it-py>=2.2.0 (from rich>=12.0.0->manim)
  Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=12.0.0->manim)
  Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
Collecting multipledispatch (from pyrr<1,>=0.10.3->moderngl-window>=2.0.0->manim)
  Using cached multipledispatch-1.0.0-py3-none-any.whl.metadata (3.8 kB)
Using cached manim-0.18.1-py3-none-any.whl (585 kB)
Using cached cloup-3.0.5-py2.py3-none-any.whl (54 kB)
Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Using cached isosurfaces-0.1.2-py3-none-any.whl (11 kB)
Using cached mapbox_earcut-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (104 kB)
Using cached moderngl-5.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (269 kB)
Using cached moderngl_window-2.4.6-py3-none-any.whl (370 kB)
Using cached networkx-3.3-py3-none-any.whl (1.7 MB)
Using cached numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
Using cached pillow-10.3.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB)
Using cached pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Using cached pygments-2.18.0-py3-none-any.whl (1.2 MB)
Using cached rich-13.7.1-py3-none-any.whl (240 kB)
Using cached scipy-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (38.6 MB)
Using cached screeninfo-0.8.1-py3-none-any.whl (12 kB)
Using cached skia_pathops-0.8.0.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.5 MB)
Using cached svgelements-1.9.6-py2.py3-none-any.whl (137 kB)
Using cached tqdm-4.66.4-py3-none-any.whl (78 kB)
Using cached typing_extensions-4.11.0-py3-none-any.whl (34 kB)
Using cached watchdog-4.0.0-py3-none-manylinux2014_x86_64.whl (82 kB)
Using cached glcontext-2.5.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (51 kB)
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Using cached pyglet-2.0.15-py3-none-any.whl (884 kB)
Using cached pyrr-0.10.3-py3-none-any.whl (46 kB)
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Using cached multipledispatch-1.0.0-py3-none-any.whl (12 kB)
Building wheels for collected packages: manimpango, pycairo
  Building wheel for manimpango (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for manimpango (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/__init__.py -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/utils.py -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/_version.py -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/cmanimpango.pxd -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/pango.pxd -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/register_font.pxd -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/cairo.pxd -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/glib.pxd -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/enums.pyx -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/register_font.pyx -> build/lib.linux-x86_64-cpython-311/manimpango
      copying manimpango/cmanimpango.pyx -> build/lib.linux-x86_64-cpython-311/manimpango
      running build_ext
      building 'manimpango.cmanimpango' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/tmp
      creating build/temp.linux-x86_64-cpython-311/tmp/pip-install-jjpnups8
      creating build/temp.linux-x86_64-cpython-311/tmp/pip-install-jjpnups8/manimpango_7d3957f25eea4f24960187125aae3f3f
      creating build/temp.linux-x86_64-cpython-311/tmp/pip-install-jjpnups8/manimpango_7d3957f25eea4f24960187125aae3f3f/manimpango
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -fPIC -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/snap/blender/4786/4.1/python/include/python3.11 -c /tmp/pip-install-jjpnups8/manimpango_7d3957f25eea4f24960187125aae3f3f/manimpango/cmanimpango.c -o build/temp.linux-x86_64-cpython-311/tmp/pip-install-jjpnups8/manimpango_7d3957f25eea4f24960187125aae3f3f/manimpango/cmanimpango.o -pthread -pthread
      /tmp/pip-install-jjpnups8/manimpango_7d3957f25eea4f24960187125aae3f3f/manimpango/cmanimpango.c:83:10: fatal error: Python.h: Aucun fichier ou dossier de ce nom
         83 | #include "Python.h"
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for manimpango
  Building wheel for pycairo (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pycairo (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/cairo
      copying cairo/__init__.py -> build/lib.linux-x86_64-cpython-311/cairo
      copying cairo/__init__.pyi -> build/lib.linux-x86_64-cpython-311/cairo
      copying cairo/py.typed -> build/lib.linux-x86_64-cpython-311/cairo
      running build_ext
      building 'cairo._cairo' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/cairo
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -fPIC -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=26 -DPYCAIRO_VERSION_MICRO=0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/snap/blender/4786/4.1/python/include/python3.11 -c cairo/bufferproxy.c -o build/temp.linux-x86_64-cpython-311/cairo/bufferproxy.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wunused-but-set-variable -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
      cairo/bufferproxy.c:32:10: fatal error: Python.h: Aucun fichier ou dossier de ce nom
         32 | #include <Python.h>
Terminal output ``` PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR ```

System specifications

System Details - OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Ubuntu 22.04.4 LTS - Python version (`python/py/python3 --version`): Python 3.10.12 - Installed modules (provide output from `pip list`): ``` Package Version ------------------ --------- autopep8 1.6.0 blinker 1.7.0 certifi 2021.10.8 charset-normalizer 2.0.10 click 8.1.7 Cython 0.29.30 debugpy 1.8.1 Flask 3.0.3 idna 3.3 itsdangerous 2.2.0 Jinja2 3.1.3 MarkupSafe 2.1.5 numpy 1.24.3 pip 24.0 pycodestyle 2.8.0 requests 2.27.1 setuptools 69.5.1 toml 0.10.2 urllib3 1.26.8 Werkzeug 3.0.2 wheel 0.43.0 zstandard 0.16.0 ```
LaTeX details + LaTeX distribution (e.g. TeX Live 2020): TeX Live 2022 + Installed LaTeX packages:

Additional comments

behackl commented 6 months ago

Are you sure apt install python3-dev ran successfully? I've just tried in a new 22.04-container:

% docker run -it --rm ubuntu:22.04 bash
root@bdaf95e9fd7c:/# ...
root@bdaf95e9fd7c:/# history
    1  apt update && apt upgrade
    2  apt install build-essential python3-dev libcairo2-dev libpango1.0-dev ffmpeg
    3  apt install python3-pip
    4  pip install manim
    5  history

and did not run into issues with building the manimpango wheel. Cannot reproduce your issue. What is the output of pip3 -V?

pterusgithub commented 6 months ago

hello

I 've tried your command to be sure :

build-essential est déjà la version la plus récente (12.9ubuntu3).
libcairo2-dev est déjà la version la plus récente (1.16.0-5ubuntu2).
libpango1.0-dev est déjà la version la plus récente (1.50.6+ds-2ubuntu1).
python3-dev est déjà la version la plus récente (3.10.6-1~22.04).
ffmpeg est déjà la version la plus récente (7:4.4.2-0ubuntu0.22.04.1).

python3-pip est déjà la version la plus récente (22.0.2+dfsg-1ubuntu0.4).

$ pip install manim
[...]
Building wheels for collected packages: manimpango, pycairo
  Building wheel for manimpango (pyproject.toml) ... error
  error: subprocess-exited-with-error
[...]
     /tmp/pip-install-0hjarea5/manimpango_4520ad6bcd80445e918d233912aaeb9d/manimpango/cmanimpango.c:83:10: fatal error: Python.h: Aucun fichier ou dossier de ce nom
         83 | #include "Python.h"

pip3 -V
pip 24.0 from /[...]/.local/lib/python3.11/site-packages/pip (python 3.11)
pterusgithub commented 6 months ago

My bad the problem came from a bad choice of pip version while installing manim.