Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3.6 in tensorflow gpu docker images

How can I have python3.6 in tensorflow docker images.

All the images I tried (latest, nighty) are using python3.5 and I don't want to modify all my scripts.

like image 535
ClementWalter Avatar asked Jul 03 '18 06:07

ClementWalter


Video Answer


2 Answers

The Tensorflow images are based on Ubuntu 16.04, as you can see from the Dockerfile. This release ships with Python 3.5 as standard.

So you'll have to re-build the image, and the Dockerfile will need editing, even though you need to do the actual build with the parameterized_docker_build.sh script.

This answer on ask Ubuntu covers how to get Python 3.6 on Ubuntu 16.04

The simplest way would probably be just to change the From line in the Dockerfile to FROM ubuntu:16.10, and python to python3.6 in the initial apt-get install line

Of course, this may break some other Ubuntu version-specific thing, so an alternative would be to keep Ubuntu 16.04 and install one of the alternative ppa's also listed in the linked answer:

RUN add-apt-repository ppa:deadsnakes/ppa &&
    apt-get update &&
    apt-get install -y python3.6
  • Note that you'll need this after the initial apt-get install, because that installs software-properties-common, which you need to add the ppa.
  • Note also, as in the comments to the linked answer, that you will need to symlink to Python 3.6.
  • Finally, note that I haven't tried any of this. The may be gotchas, and you may need to make another change to ensure that the correct version of Python is used by the running container.
like image 68
SiHa Avatar answered Oct 01 '22 22:10

SiHa


You can use stable images which are supplied by third parties, like ufoym/deepo. One that fits TensorFlow, python3.6 and cuda10 can be found here or you can pull it directly using the command docker pull ufoym/deepo:py36-cu100

I use their images all the time, never had problems

like image 38
bluesummers Avatar answered Oct 02 '22 00:10

bluesummers