Flatpak manifest with matplotlib as a dependency

Hello,

I am trying to add matplotlib as a dependency in a flatpak manifest. Here below is the output of the build process:

========================================================================
Building module python3-matplotlib in /home/vcottineau/Documents/Informatique/Projets/GitHub/Private/pyShumate/.flatpak/flatpak-builder/build/python3-matplotlib-9
========================================================================
Running: pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "matplotlib" --no-build-isolation
Using pip 24.0 from /usr/lib/python3.11/site-packages/pip (python 3.11)
Looking in links: file:///run/build/python3-matplotlib
Processing ./matplotlib-3.9.1.tar.gz
  Running command Preparing metadata (pyproject.toml)
  + meson setup /tmp/pip-install-lpyvc_xz/matplotlib_65eac610c4f047fea6e42ce32308fb47 /tmp/pip-install-lpyvc_xz/matplotlib_65eac610c4f047fea6e42ce32308fb47/.mesonpy-rxpa2467 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/tmp/pip-install-lpyvc_xz/matplotlib_65eac610c4f047fea6e42ce32308fb47/.mesonpy-rxpa2467/meson-python-native-file.ini
  The Meson build system
  Version: 1.3.2
  Source dir: /tmp/pip-install-lpyvc_xz/matplotlib_65eac610c4f047fea6e42ce32308fb47
  Build dir: /tmp/pip-install-lpyvc_xz/matplotlib_65eac610c4f047fea6e42ce32308fb47/.mesonpy-rxpa2467
  Build type: native build
  Program python3 found: YES (/usr/bin/python3)
  Project name: matplotlib
  Project version: 3.9.1
  C compiler for the host machine: ccache cc (gcc 13.2.0 "cc (GCC) 13.2.0")
  C linker for the host machine: cc ld.bfd 2.42
  C++ compiler for the host machine: ccache c++ (gcc 13.2.0 "c++ (GCC) 13.2.0")
  C++ linker for the host machine: c++ ld.bfd 2.42
  Host machine cpu family: x86_64
  Host machine cpu: x86_64
  Program python found: YES (/usr/bin/python)
  Found pkg-config: YES (/usr/bin/pkg-config) 2.2.0
  Run-time dependency python found: YES 3.11
  pybind11-config found: YES (/app/bin/pybind11-config) 2.13.1
  Run-time dependency pybind11 found: YES 2.13.1
  Downloading freetype-2.6.1 source from https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  Downloading freetype-2.6.1 source from https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>
  WARNING: failed to download with error: could not get https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz is the internet available?. Trying after a delay...
  <urlopen error [Errno -3] Temporary failure in name resolution>

  ../extern/meson.build:19:18: ERROR: could not get https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz is the internet available?

  A full log can be found at /tmp/pip-install-lpyvc_xz/matplotlib_65eac610c4f047fea6e42ce32308fb47/.mesonpy-rxpa2467/meson-logs/meson-log.txt
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python /usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpnaa2fqba
  cwd: /tmp/pip-install-lpyvc_xz/matplotlib_65eac610c4f047fea6e42ce32308fb47
  Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Error: module python3-matplotlib: Le processus fils s’est terminé avec le code 1
>>> Error: Child process exited with code 1

Module included in the flatpak manifest using the following command:
python flatpak-pip-generator.py --runtime=org.gnome.Sdk//46 matplotlib

{
    "name": "python3-matplotlib",
    "buildsystem": "simple",
    "build-commands": [
        "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"matplotlib\" --no-build-isolation"
    ],
    "sources": [
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/8d/9e/e4786569b319847ffd98a8326802d5cf8a5500860dbfc2df1f0f4883ed99/contourpy-1.2.1.tar.gz",
            "sha256": "4d8908b3bee1c889e547867ca4cdc54e5ab6be6d3e078556814a22457f49423c"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/e7/05/c19819d5e3d95294a6f5947fb9b9629efb316b96de511b418c53d245aae6/cycler-0.12.1-py3-none-any.whl",
            "sha256": "85cef7cff222d8644161529808465972e51340599459b8ac3ccbac5a854e0d30"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/c6/cb/cd80a0da995adde8ade6044a8744aee0da5efea01301cadf770f7fbe7dcc/fonttools-4.53.1.tar.gz",
            "sha256": "e128778a8e9bc11159ce5447f76766cefbd876f44bd79aff030287254e4752c4"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/b9/2d/226779e405724344fc678fcc025b812587617ea1a48b9442628b688e85ea/kiwisolver-1.4.5.tar.gz",
            "sha256": "e57e563a57fb22a142da34f38acc2fc1a5c864bc29ca1517a88abc963e60d6ec"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/22/06/9e8ba6ec8b716a215404a5d1938b61f5a28001be493cf35344dda9a4072a/matplotlib-3.9.1.tar.gz",
            "sha256": "de06b19b8db95dd33d0dc17c926c7c9ebed9f572074b6fac4f65068a6814d010"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/05/35/fb1ada118002df3fe91b5c3b28bc0d90f879b881a5d8f68b1f9b79c44bfe/numpy-2.0.0.tar.gz",
            "sha256": "cf5d1c9e6837f8af9f92b6bd3e86d513cdc11f60fd62185cc49ec7d1aba34864"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/08/aa/cc0199a5f0ad350994d660967a8efb233fe0416e4639146c089643407ce6/packaging-24.1-py3-none-any.whl",
            "sha256": "5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/cd/74/ad3d526f3bf7b6d3f408b73fde271ec69dfac8b81341a318ce825f2b3812/pillow-10.4.0.tar.gz",
            "sha256": "166c1cd4d24309b30d61f79f4a9114b7b2313d7450912277855ff5dfd7cd4a06"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/9d/ea/6d76df31432a0e6fdf81681a895f009a4bb47b3c39036db3e1b528191d52/pyparsing-3.1.2-py3-none-any.whl",
            "sha256": "f9db75911801ed778fe61bb643079ff86601aca99fcae6345aa67292038fb742"
        },
        {
            "type": "file",
            "url": "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl",
            "sha256": "a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"
        }
    ]
}

I found this issue related to flatpak-pip-generator but no clear solution is given: flatpak-pip-generator not working for matplotlib · Issue #47 · flatpak/flatpak-builder-tools · GitHub

Any idea on how to make it work properly ?

I solved my issue by adding the following parameters in the flatpak manifest:

    "build-options": {
        "build-args": [
            "--share=network"
        ]
    }

At the end, I switched from flatpak-pip-generator to req2flatpak as it prefers binary wheels.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.