Skip to content

Matplotlib won't build in P4A develop #3225

Description

@vabt-igd

The matplotlib recipe in p4a develop is currently broken.
Freetype dev is installed but not picked up correctly by the toolchain:

/usr/include/freetype2$ ls -a
.  ..  freetype  ft2build.h

P4A error log:

[INFO]:    -> directory context /home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/matplotlib/arm64-v8a__ndk_target_24/matplotlib
stty: 'standard input': Inappropriate ioctl for device
[DEBUG]:   -> running python3 -m build --wheel --config-setting builddir=/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/matplotlib/arm64-v8a__ndk_target_24/matplotlib/p4a_android_build
[DEBUG]:        * Creating isolated environment: venv+pip...
[DEBUG]:        * Installing packages in isolated environment:
[DEBUG]:          - certifi>=2020.06.20
[DEBUG]:          - numpy>=2.0.0rc1,<2.3
[DEBUG]:          - pybind11>=2.6
[DEBUG]:          - setuptools>=64
[DEBUG]:          - setuptools_scm>=7
[DEBUG]:        * Getting build dependencies for wheel...
[DEBUG]:   
[DEBUG]:        Edit mplsetup.cfg to change the build options; suppress output with --quiet.
[DEBUG]:   
[DEBUG]:        BUILDING MATPLOTLIB
[DEBUG]:              python: yes [3.11.13 (main, Oct  9 2025, 16:53:18) [GCC 11.4.0]]
[DEBUG]:            platform: yes [linux]
[DEBUG]:               tests: no  [skipping due to configuration]
[DEBUG]:              macosx: no  [Mac OS-X only]
[DEBUG]:   
[DEBUG]:        /tmp/build-env-jnznzryc/lib/python3.11/site-packages/setuptools_scm/_integration/version_inference.py:51: UserWarning: version of matplotlib already set
[DEBUG]:          warnings.warn(self.message)
[DEBUG]:        /home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/root/usr/local/lib/python3.11/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
[DEBUG]:        !!
[DEBUG]:   
[DEBUG]:                ********************************************************************************
[DEBUG]:                Please consider removing the following classifiers in favor of a SPDX license expression:
[DEBUG]:   
[DEBUG]:                License :: OSI Approved :: Python Software Foundation License
[DEBUG]:   
[DEBUG]:                See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
[DEBUG]:                ********************************************************************************
[DEBUG]:   
[DEBUG]:        !!
[DEBUG]:          self._finalize_license_expression()
[DEBUG]:        running egg_info
[DEBUG]:        writing lib/matplotlib.egg-info/PKG-INFO
[DEBUG]:        writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt
[DEBUG]:        writing requirements to lib/matplotlib.egg-info/requires.txt
[DEBUG]:        writing top-level names to lib/matplotlib.egg-info/top_level.txt
[DEBUG]:        git archive detected - fallback to listing all files
[DEBUG]:        adding license file 'LICENSE/LICENSE'
[DEBUG]:        adding license file 'LICENSE/LICENSE_AMSFONTS'
[DEBUG]:        adding license file 'LICENSE/LICENSE_BAKOMA'
[DEBUG]:        adding license file 'LICENSE/LICENSE_CARLOGO'
[DEBUG]:        adding license file 'LICENSE/LICENSE_COLORBREWER'
[DEBUG]:        adding license file 'LICENSE/LICENSE_COURIERTEN'
[DEBUG]:        adding license file 'LICENSE/LICENSE_JSXTOOLS_RESIZE_OBSERVER'
[DEBUG]:        adding license file 'LICENSE/LICENSE_QHULL'
[DEBUG]:        adding license file 'LICENSE/LICENSE_QT4_EDITOR'
[DEBUG]:        adding license file 'LICENSE/LICENSE_SOLARIZED'
[DEBUG]:        adding license file 'LICENSE/LICENSE_STIX'
[DEBUG]:        adding license file 'LICENSE/LICENSE_YORICK'
[DEBUG]:        writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
[DEBUG]:        * Building wheel...
[DEBUG]:   
[DEBUG]:        Edit mplsetup.cfg to change the build options; suppress output with --quiet.
[DEBUG]:   
[DEBUG]:        BUILDING MATPLOTLIB
[DEBUG]:              python: yes [3.11.13 (main, Oct  9 2025, 16:53:18) [GCC 11.4.0]]
[DEBUG]:            platform: yes [linux]
[DEBUG]:               tests: no  [skipping due to configuration]
[DEBUG]:              macosx: no  [Mac OS-X only]
[DEBUG]:   
[DEBUG]:        /tmp/build-env-jnznzryc/lib/python3.11/site-packages/setuptools_scm/_integration/version_inference.py:51: UserWarning: version of matplotlib already set
[DEBUG]:          warnings.warn(self.message)
[DEBUG]:        /home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/root/usr/local/lib/python3.11/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
[DEBUG]:        !!
[DEBUG]:   
[DEBUG]:                ********************************************************************************
[DEBUG]:                Please consider removing the following classifiers in favor of a SPDX license expression:
[DEBUG]:   
[DEBUG]:                License :: OSI Approved :: Python Software Foundation License
[DEBUG]:   
[DEBUG]:                See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
[DEBUG]:                ********************************************************************************
[DEBUG]:   
[DEBUG]:        !!
[DEBUG]:          self._finalize_license_expression()
[DEBUG]:        running bdist_wheel
[DEBUG]:        running build
[DEBUG]:        running build_py
[DEBUG]:        copying lib/matplotlib/_version.py -> build/lib.linux-x86_64-cpython-311/matplotlib
[DEBUG]:        running build_ext
[DEBUG]:        building 'matplotlib.ft2font' extension
[DEBUG]:        /home/vboxuser/.buildozer/android/platform/android-ndk-r28c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-linux-android24 -fomit-frame-pointer -march=armv8-a -fPIC -target aarch64-linux-android24 -fomit-frame-pointer -march=armv8-a -fPIC -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/freetype/arm64-v8a__ndk_target_24/freetype/include -DANDROID -I/home/vboxuser/.buildozer/android/platform/android-ndk-r28c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Include -fPIC -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/root/usr/local/lib/python3.11/site-packages/numpy/_core/include -I/tmp/build-env-jnznzryc/include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/Include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/android-build -c src/checkdep_freetype2.c -o build/temp.linux-x86_64-cpython-311/matplotlib.ft2font/src/checkdep_freetype2.o
[DEBUG]:        src/checkdep_freetype2.c:14:9: warning: Compiling with FreeType version 2.10.1. [-W#pragma-messages]
[DEBUG]:           14 | #pragma message("Compiling with FreeType version " \
[DEBUG]:              |         ^
[DEBUG]:        1 warning generated.
[DEBUG]:        /home/vboxuser/.buildozer/android/platform/android-ndk-r28c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -target aarch64-linux-android24 -fomit-frame-pointer -march=armv8-a -fPIC -target aarch64-linux-android24 -fomit-frame-pointer -march=armv8-a -fPIC -DANDROID -I/home/vboxuser/.buildozer/android/platform/android-ndk-r28c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Include -fPIC -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/root/usr/local/lib/python3.11/site-packages/numpy/_core/include -I/tmp/build-env-jnznzryc/include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/Include -I/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/android-build -c src/ft2font.cpp -o build/temp.linux-x86_64-cpython-311/matplotlib.ft2font/src/ft2font.o
[DEBUG]:        In file included from src/ft2font.cpp:11:
[DEBUG]:        src/ft2font.h:12:10: fatal error: 'ft2build.h' file not found
[DEBUG]:           12 | #include <ft2build.h>
[DEBUG]:              |          ^~~~~~~~~~~~
[DEBUG]:        1 error generated.
[DEBUG]:        error: command '/home/vboxuser/.buildozer/android/platform/android-ndk-r28c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++' failed with exit code 1
[DEBUG]:   
[DEBUG]:        ERROR Backend subprocess exited when trying to invoke build_wheel
Exception in thread background thread for pid 388873:
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/home/vboxuser/p4a_builds/mpl_test_app/.venv/lib/python3.11/site-packages/sh.py", line 1642, in wrap
    fn(*rgs, **kwargs)
  File "/home/vboxuser/p4a_builds/mpl_test_app/.venv/lib/python3.11/site-packages/sh.py", line 2647, in background_thread
    handle_exit_code(exit_code)
  File "/home/vboxuser/p4a_builds/mpl_test_app/.venv/lib/python3.11/site-packages/sh.py", line 2338, in fn
    return self.command.handle_command_exit_code(exit_code)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vboxuser/p4a_builds/mpl_test_app/.venv/lib/python3.11/site-packages/sh.py", line 823, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/android-build/python3 -m build --wheel --config-setting builddir=/home/vboxuser/p4a_builds/mpl_test_app/.buildozer/android/platform/build-arm64-v8a/build/other_builds/matplotlib/arm64-v8a__ndk_target_24/matplotlib/p4a_android_build

Tested on Ubuntu 22.04 and Ubuntu 24.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions