Closed rafaelcpalmeida closed 1 year ago
This is the same as: https://github.com/docker-library/python/issues/174 https://github.com/docker-library/python/issues/345 https://github.com/docker-library/python/issues/486, but in this case the one from Debian is newer than the one we add to /usr/local/
See also the blurb on the Docker Hub docs: https://github.com/docker-library/docs/tree/883d8e242e5cdb1a95c6d530d49b76631a6af030/python#multiple-python-versions-in-the-image
To put that another way, if you've been using /usr/bin/python3
, you might as well switch to using raw buildpack-deps
or even FROM debian
because you haven't been running the Python build provided by this image. :sweat_smile:
I see 🤔 Using python:3.9-slim
I'm still getting Python 3.11, is this intentional? Per https://github.com/docker-library/docs/tree/883d8e242e5cdb1a95c6d530d49b76631a6af030/python#multiple-python-versions-in-the-image I assumed it shouldn't happen.
Using python:3.9-slim
(or any of the python
images), you need to use /usr/local/bin/python3
, /usr/bin/env python3
or just plain python3
if you want the Python we compile in the image. If you use the full path to the Debian python, then you will get the Debian python version. We don't replace/override that because it could break system packages.
If /usr/bin/python3
(Debian python) exists in the slim
image, then it means you installed a Debian package that required it.
$ docker run -it --rm python:3.9-slim bash
Unable to find image 'python:3.9-slim' locally
3.9-slim: Pulling from library/python
5b5fe70539cd: Already exists
f4b0e4004dc0: Pull complete
ec1650096fae: Pull complete
2ee3c5a347ae: Pull complete
d854e82593a7: Pull complete
Digest: sha256:0074c6241f2ff175532c72fb0fb37264e8a1ac68f9790f9ee6da7e9fdfb67a0e
Status: Downloaded newer image for python:3.9-slim
root@dbad579b3cc2:/# /usr/local/bin/python3 --version
Python 3.9.17
root@dbad579b3cc2:/# /usr/bin/env python3 --version
Python 3.9.17
root@dbad579b3cc2:/# python3 --version
Python 3.9.17
root@dbad579b3cc2:/# /usr/bin/python3
bash: /usr/bin/python3: No such file or directory
That makes sense to me. Appreciate the time you took to explain it! I'll then close this as it doesn't make sense to keep it open.
While re-reading our description with the fresh eyes you've provided (especially the Debian Python now in the rare case of being newer than many of ours), I've put up https://github.com/docker-library/docs/pull/2344 to hopefully clarify this better. :bow: :heart:
That's more clear now! Thank you for the time you took to explain it and for your attention! 🙇🏽♂️
I've recently noticed that the newest changes introduced on
python:3.9
are breaking the/usr/bin/python3
symlink pointing it topython3.11
instead ofpython3.9
A
python:3.9
image freshly pulled from DockerHub:A
python:3.9
image I had on another machine pulled some time ago:Looking at DockerHub it seems that this layer is introducing Python 3.11:
Tell me if there's anything else I would need to add to this issue.