Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images based on 3.12 still point to 3.11.2 Python #966

Closed
dcjulian29 opened this issue Sep 12, 2024 · 3 comments
Closed

Images based on 3.12 still point to 3.11.2 Python #966

dcjulian29 opened this issue Sep 12, 2024 · 3 comments

Comments

@dcjulian29
Copy link

I build a few images off of the python:3.12.*-slim-bookworm base image but anthing built on that that uses "python " still uses 3.11.2 so none of the PIP modules installed during the image creation are accessable. When I revert to a 3.11. base image, everything works.

@yosifkit
Copy link
Member

$ docker run -it --rm python:3.12-slim-bookworm bash
Unable to find image 'python:3.12-slim-bookworm' locally
3.12-slim-bookworm: Pulling from library/python
e3c0797c07c1: Download complete
742f4b315eb0: Download complete
da3b97defdfc: Download complete
05496fb6d95d: Download complete
Digest: sha256:8ac54da5710cdd31639bb66f5bc1888948fc2866c0b5b52913b4b33d8252e510
Status: Downloaded newer image for python:3.12-slim-bookworm
root@591192a14dfe:/# python --version
Python 3.12.6

Are you perhaps installing python3-dev or other packages that would pull in python3 from apt? This would bring in the Debian package of python3 and thus the image would end up with two versions of python 3. The image-provided python binaries are provided in /usr/local/bin. The Debian provided binaries would be in /usr/bin/. If your python files start with a #!/usr/bin/python3 and you just execute them directly (./script.py), then they'll use the Debian provided python (and thus not see any pip installed packages from the image-provided pip).

So similar to #885 and #927 (comment)?

@dcjulian29
Copy link
Author

I needed virtenv so that was installed which would explain the multiple versions, I'll look for a different way to build my image without the virtenv

@tianon
Copy link
Member

tianon commented Sep 12, 2024

You should be able to install virtualenv via pip instead (or use https://docs.python.org/3/library/venv.html, which I think is part of Python itself?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants