Visitar URL original
Matplotlib 3.4.3 wheel unable to build - cannot find Python.h · Issue #20834 · matplotlib/matplotlib · GitHub
The Wayback Machine - https://web.archive.org/web/20260106115521/https://github.com/matplotlib/matplotlib/issues/20834
Skip to content

Matplotlib 3.4.3 wheel unable to build - cannot find Python.h #20834

@thegnarwhals

Description

@thegnarwhals

In a minimal docker container with python3-dev installed, pip install matplotlib==3.4.3 gives an error ending

...
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__backend_agg_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -DFREETYPE_BUILD_TYPE=local -Ibuild/freetype-2.6.1/include -Iextern/agg24-svn/include -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/include/python3.8 -c src/mplutils.cpp -o build/temp.linux-x86_64-3.8/src/mplutils.o -fvisibility=hidden -flto
    In file included from src/mplutils.cpp:3:0:
    src/mplutils.h:30:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u5hy07s_/matplotlib_f8f90367c2be475d814b963c95f58343/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u5hy07s_/matplotlib_f8f90367c2be475d814b963c95f58343/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-7zap5ode/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/matplotlib Check the logs for full command output.

edit: minimal example:

docker run -it --rm --net host ubuntu:18.04
# Inside docker container:
apt-get update -y && apt-get install python3.8 python3-pip -y && python3.8 -m pip install --upgrade pip
python3.8 -m pip install --no-binary matplotlib matplotlib  # this fails
apt list --installed | grep python3-dev

# Output:
# libpython3-dev/bionic-updates,now 3.6.7-1~18.04 amd64 [installed,automatic]
# python3-dev/bionic-updates,now 3.6.7-1~18.04 amd64 [installed,automatic]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions