Repository navigation
Recent python:3.9-slim causing some libraries to break after removing --with-system-expat #984
Description
Activity
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 -yRight after the
FROMand the issue is gone.So, it can be closed if the removal of
--with-system-expatwas intentionalsame 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?
same issue from 3.10.14 to 3.10.15 and uwsgi that need the library (libexpact)
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?
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
libexpat1manually in the slim images (it being included previously was incidental, not part of the intentional interface of the image).@tianon thanks for the response! I'll include it wherever needed in my images.
Reacted by Tianon Gravi- added a commit that references this issue
on Jan 8, 2025
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-expatflag was removed along withlibexpat-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!