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

Buster image contains Python 3.7 (and not 3.8) #424

Closed
Nicholas-Autio-Mitchell opened this issue Oct 16, 2019 · 2 comments
Closed

Buster image contains Python 3.7 (and not 3.8) #424

Nicholas-Autio-Mitchell opened this issue Oct 16, 2019 · 2 comments

Comments

@Nicholas-Autio-Mitchell

Are the images containing the newly released Python version 3.8 up and running? I understood so from the README and listed tags.

I would like to create a custom image based on the python3.8-buster image.

I created a simple Dockerfile with the contents:

FROM python:buster
RUN pip install numpy

and build the image with:

$  docker build -t my_buster_image .

I create and enter a container from the built image and check which python versions are available:

$  docker run -it my_buster_image /bin/bash

root@9f04520130a0:/# which -a python
/usr/local/bin/python
/usr/local/bin/python
/usr/bin/python

root@9f04520130a0:/# which -a python3.8
# empty return

root@9f04520130a0:/# which -a python3.7
/usr/local/bin/python3.7
/usr/local/bin/python3.7
/usr/bin/python3.7

Questions:

  1. Have I done something incorrectly?
  2. How can I get an image running 3.8 and install my own packages?

Remarks:

  1. I also tried using the developers Python image that holds many python versions. That does contain Python 3.8, however is built in such a way that I cannot simply build from it and add a line:

RUN pip install numpy

@Nicholas-Autio-Mitchell
Copy link
Author

Nicholas-Autio-Mitchell commented Oct 16, 2019

I took the (generated) Dockerfile from the Python repository (under: python/3.8/buster/Dockerfile) and was able to append my simple pip install ... line, and successfully build the image. It took a total of 25 minutes - partly because numpy had to also be compiled as pip didn't have a wheel available.

Then running the same as above in the container, I get:

$  docker run -it my_buster_image /bin/bash

root@c93e1f8d7221:/# which -a python
/usr/local/bin/python
/usr/local/bin/python
/usr/bin/python

root@c93e1f8d7221:/# which -a python3.8
/usr/local/bin/python3.8
/usr/local/bin/python3.8

root@c93e1f8d7221:/# which -a python3.7
/usr/bin/python3.7

So Python version 3.8 is there (and 3.7, which is perhaps unexpected).

I could also use my own numpy as expected:

root@c93e1f8d7221:/# python3.8
Python 3.8.0 (default, Oct 16 2019, 00:17:43) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import numpy as np
>>> np.random.random(10)
array([0.6470034 , 0.26120951, 0.54700188, 0.25709831, 0.70114084,
       0.85906728, 0.85868124, 0.67499514, 0.34384473, 0.45151778])

@wglambert
Copy link
Member

Maybe the updated image wasn't pushed yet to Dockerhub when you had tried using it docker-library/official-images#6788
It would have been 3 hours after the merge

It's updated now so I'm going to close

$ docker pull python:buster
buster: Pulling from library/python
4a56a430b2ba: Already exists 
4b5cacb629f5: Already exists 
14408c8d4f9a: Already exists 
ea67eaa7dd42: Already exists 
4d134ac3fe4b: Already exists 
4c55f6f5d7f0: Pull complete 
254e105a5240: Pull complete 
24b2d397f4c8: Pull complete 
b0394dbabd13: Pull complete 
Digest: sha256:110dd1117dabc28bbf7bcc8f6d24ace3e999880af7772a18f0ea6a29458dcb8b                                                                               
Status: Downloaded newer image for python:buster

$ docker run -it --rm python:buster bash
root@e795dace5711:/# python -V
Python 3.8.0 

root@e795dace5711:/# pip --version
pip 19.3 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

root@e795dace5711:/# which -a python3.8
/usr/local/bin/python3.8                                                                                                                                      
/usr/local/bin/python3.8

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

2 participants