I wanted to check out the Microblog application and I tried to build it with Docker, but it looks like the multidict package is problematic in python:slim:
$ docker build -t microblog:latest .
[+] Building 33.5s (7/13) docker:desktop-linux
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 374B 0.0s
=> [internal] load metadata for docker.io/library/python:slim 0.3s
=> [1/9] FROM docker.io/library/python:slim@sha256:db7e9284d53f7b827c58a6239b9d2907c33250215823b1cdb7d1e983e70da 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 3.31kB 0.0s
=> CACHED [2/9] COPY requirements.txt requirements.txt 0.0s
=> ERROR [3/9] RUN pip install -r requirements.txt 33.1s
------
...
32.65 Building wheel for multidict (pyproject.toml): started
32.80 Building wheel for multidict (pyproject.toml): finished with status 'error'
32.81 error: subprocess-exited-with-error
32.81
32.81 × Building wheel for multidict (pyproject.toml) did not run successfully.
32.81 │ exit code: 1
32.81 ╰─> [77 lines of output]
32.81 *********************
32.81 * Accelerated build *
32.81 *********************
32.81 running bdist_wheel
32.81 running build
32.81 running build_py
32.81 creating build
32.81 creating build/lib.linux-x86_64-cpython-312
32.81 creating build/lib.linux-x86_64-cpython-312/multidict
32.81 copying multidict/_abc.py -> build/lib.linux-x86_64-cpython-312/multidict
32.81 copying multidict/_multidict_base.py -> build/lib.linux-x86_64-cpython-312/multidict
32.81 copying multidict/_multidict_py.py -> build/lib.linux-x86_64-cpython-312/multidict
32.81 copying multidict/_compat.py -> build/lib.linux-x86_64-cpython-312/multidict
32.81 copying multidict/__init__.py -> build/lib.linux-x86_64-cpython-312/multidict
32.81 running egg_info
32.81 writing multidict.egg-info/PKG-INFO
32.81 writing dependency_links to multidict.egg-info/dependency_links.txt
32.81 writing top-level names to multidict.egg-info/top_level.txt
32.81 reading manifest file 'multidict.egg-info/SOURCES.txt'
32.81 reading manifest template 'MANIFEST.in'
32.81 warning: no previously-included files matching '*.pyc' found anywhere in distribution
32.81 warning: no previously-included files found matching 'multidict/_multidict.html'
32.81 warning: no previously-included files found matching 'multidict/*.so'
32.81 warning: no previously-included files found matching 'multidict/*.pyd'
32.81 warning: no previously-included files found matching 'multidict/*.pyd'
32.81 no previously-included directories found matching 'docs/_build'
32.81 adding license file 'LICENSE'
32.81 writing manifest file 'multidict.egg-info/SOURCES.txt'
32.81 /tmp/pip-build-env-g9hma3yk/overlay/lib/python3.12/site-packages/setuptools/command/build_py.py:207: _Warning: Package 'multidict._multilib' is absent from the `packages` configuration.
32.81 !!
32.81
32.81 ********************************************************************************
32.81 ############################
32.81 # Package would be ignored #
32.81 ############################
32.81 Python recognizes 'multidict._multilib' as an importable package[^1],
32.81 but it is absent from setuptools' `packages` configuration.
32.81
32.81 This leads to an ambiguous overall configuration. If you want to distribute this
32.81 package, please make sure that 'multidict._multilib' is explicitly added
32.81 to the `packages` configuration field.
32.81
32.81 Alternatively, you can also rely on setuptools' discovery methods
32.81 (for example by using `find_namespace_packages(...)`/`find_namespace:`
32.81 instead of `find_packages(...)`/`find:`).
32.81
32.81 You can read more about "package discovery" on setuptools documentation page:
32.81
32.81 - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
32.81
32.81 If you don't want 'multidict._multilib' to be distributed and are
32.81 already explicitly excluding 'multidict._multilib' via
32.81 `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
32.81 you can try to use `exclude_package_data`, or `include-package-data=False` in
32.81 combination with a more fine grained `package-data` configuration.
32.81
32.81 You can read more about "package data files" on setuptools documentation page:
32.81
32.81 - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
32.81
32.81
32.81 [^1]: For Python, any directory (with suitable naming) can be imported,
32.81 even if it does not contain any `.py` files.
32.81 On the other hand, currently there is no concept of package data
32.81 directory, all directories are treated like packages.
32.81 ********************************************************************************
32.81
32.81 !!
32.81 check.warn(importable)
32.81 copying multidict/__init__.pyi -> build/lib.linux-x86_64-cpython-312/multidict
32.81 copying multidict/py.typed -> build/lib.linux-x86_64-cpython-312/multidict
32.81 creating build/temp.linux-x86_64-cpython-312
32.81 creating build/temp.linux-x86_64-cpython-312/multidict
32.81 gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include/python3.12 -c multidict/_multidict.c -o build/temp.linux-x86_64-cpython-312/multidict/_multidict.o -O2 -std=c99 -Wall -Wsign-compare -Wconversion -fno-strict-aliasing -pedantic
32.81 error: command 'gcc' failed: No such file or directory
32.81 [end of output]
32.81
32.81 note: This error originates from a subprocess, and is likely not a problem with pip.
32.81 ERROR: Failed building wheel for multidict
32.81 Successfully built Flask-Mail langdetect
32.82 Failed to build multidict
32.82 ERROR: Could not build wheels for multidict, which is required to install pyproject.toml-based projects
I was able to work around this by changing the FROM target to python:3.11-alpine:
I wanted to check out the Microblog application and I tried to build it with Docker, but it looks like the multidict package is problematic in
python:slim
:I was able to work around this by changing the
FROM
target topython:3.11-alpine
: