Search code examples
pythonlinuxgtkflatpakgnome-builder

Python dependency on Gnome Builder


I am learning how to create GTK applications in python and I am using Gnome Builder IDE installed through flatpak. I wanted to use the python package requests in my application, so I added:

{
    "name": "pip-install",
    "buildsystem": "simple",
    "build-options": {
      "build-args": [
        "--share=network"
      ]
    },
    "build-commands": [
        "pip3 install requests"
    ]
}

To my modules list inside the flatpak .json file of the project. When I try to build the project I get the following error when the command runs pip:

ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/usr/lib/python3.7/site-packages/idna-2.9.dist-info'

One solution would be the dependency being installed on user space, but how to do that?


Solution

  • I've successfully used this snippet before:

        {
            "name": "requests",
            "buildsystem": "simple",
            "build-options": {
              "build-args": [
                "--share=network"
              ]
            },
            "build-commands": [
                "pip3 install --prefix=/app --no-cache-dir requests"
            ]
        }
    

    The /app directory is writable and the rest of your application should be there as well.