Skip to content

Recent python:3.9-slim causing some libraries to break after removing --with-system-expat #984

Description

@mati-o

Hey, thanks for your great effort in this project and I apologize ahead if my issue is not an issue :).

With the recent 3.9-slim, after merging #980 , the --with-system-expat flag was removed along with libexpat-dev, this causes all my images to break since a requirement I use extensively , fiona, needs it.

Assuming this change is mandatory, I would be happy for a solution, workaround or whatever can help me get through it. Many thanks!

Activity

  1. mati-o commented on Oct 19, 2024

    @mati-o
    Author

    Found a workaround myself. From the README:

    Use this image and install any required Debian packages before running pip install.

    So I added to my dockerfile:

    RUN apt-get update && apt-get install libexpat1 -y

    Right after the FROM and the issue is gone.

    So, it can be closed if the removal of --with-system-expat was intentional

  2. BielStela commented on Oct 21, 2024

    @BielStela

    same issue with 3.12-slim and another geospatial library (GDAL). Fixed it by pinning to 3.12.6 but I guess the way to go is to explicitly install this kind of dependencies by hand in the dockerfile like @mati-o did isn't it?

  3. D0wn3r commented on Oct 21, 2024

    @D0wn3r

    same issue from 3.10.14 to 3.10.15 and uwsgi that need the library (libexpact)

  4. tianon commented on Oct 21, 2024

    @tianon
    Member

    The removal was intentional -- can you elaborate on what the problem is? What's the error message? Is there an easy way to reproduce the problem?

  5. tianon commented on Oct 21, 2024

    @tianon
    Member

    Managed to get a clean reproducer:

    $ docker run -it --rm --pull=always python:3.9-slim bash
    3.9-slim: Pulling from library/python
    Digest: sha256:7a9cd42706c174cdcf578880ab9ae3b6551323a7ddbc2a89ad6e5b20a28fbfbe
    Status: Image is up to date for python:3.9-slim
    root@708fcd2277b5:/# pip install fiona
    Collecting fiona
      Downloading fiona-1.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.3/17.3 MB 27.4 MB/s eta 0:00:00
    Collecting attrs>=19.2.0
      Downloading attrs-24.2.0-py3-none-any.whl (63 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.0/63.0 kB 14.9 MB/s eta 0:00:00
    Collecting click~=8.0
      Downloading click-8.1.7-py3-none-any.whl (97 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.9/97.9 kB 22.9 MB/s eta 0:00:00
    Collecting certifi
      Downloading certifi-2024.8.30-py3-none-any.whl (167 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 167.3/167.3 kB 37.4 MB/s eta 0:00:00
    Collecting click-plugins>=1.0
      Downloading click_plugins-1.1.1-py2.py3-none-any.whl (7.5 kB)
    Collecting cligj>=0.5
      Downloading cligj-0.7.2-py3-none-any.whl (7.1 kB)
    Collecting importlib-metadata
      Downloading importlib_metadata-8.5.0-py3-none-any.whl (26 kB)
    Collecting zipp>=3.20
      Downloading zipp-3.20.2-py3-none-any.whl (9.2 kB)
    Installing collected packages: zipp, click, certifi, attrs, importlib-metadata, cligj, click-plugins, fiona
    Successfully installed attrs-24.2.0 certifi-2024.8.30 click-8.1.7 click-plugins-1.1.1 cligj-0.7.2 fiona-1.10.1 importlib-metadata-8.5.0 zipp-3.20.2
    WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
    
    [notice] A new release of pip is available: 23.0.1 -> 24.2
    [notice] To update, run: pip install --upgrade pip
    root@708fcd2277b5:/# python
    Python 3.9.20 (main, Oct 19 2024, 01:00:38) 
    [GCC 12.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import fiona
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.9/site-packages/fiona/__init__.py", line 42, in <module>
        from fiona._env import (
    ImportError: libexpat.so.1: cannot open shared object file: No such file or directory

    While unfortunate, yes, this does mean you'll want/need to install libexpat1 manually in the slim images (it being included previously was incidental, not part of the intentional interface of the image).

  6. mati-o commented on Oct 22, 2024

    @mati-o
    Author

    @tianon thanks for the response! I'll include it wherever needed in my images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions