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

Support python3 on Docker image tensorflow/tensorflow:latest #10179

Closed
campoy opened this issue May 25, 2017 · 14 comments
Closed

Support python3 on Docker image tensorflow/tensorflow:latest #10179

campoy opened this issue May 25, 2017 · 14 comments
Assignees
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower type:build/install Build and install issues

Comments

@campoy
Copy link

campoy commented May 25, 2017

System information

I'm running the tensorflow/tensorflow:latest Docker image

$ docker run -it --rm tensorflow/tensorflow python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'tensorflow'

Note that the same works perfectly for Python 2:

✗ docker run -it --rm tensorflow/tensorflow python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>>

Describe the problem

Importing tensorflow from python3 fails for the tensorflow/tensorflow Docker image
This is surprising because python3 itself is installed, so the solution is:

a) make tensorflow be importable from python3
b) remote python3 so it's obvious you need to use a different tag (point at it, maybe)

@jart
Copy link
Contributor

jart commented May 26, 2017

We do support Python 3000 on Docker. It's just released under different tags.

Try tensorflow/tensorflow:latest-py3.

@jart jart closed this as completed May 26, 2017
@jart jart added the type:support Support issues label May 26, 2017
@campoy
Copy link
Author

campoy commented May 26, 2017

I understand there is a different tag, but this is confusing no matter how much you document it.

Why isn't tensorflow supported for Python3 on latest?
If it's for image size concerns, shouldn't we also remove python3 completely from latest?

Thanks

@jart
Copy link
Contributor

jart commented May 27, 2017

@gunan our friend is curious as to why the python3 command exists on our docker tag latest if you need to install latest-py3 for it to work.

@gunan
Copy link
Contributor

gunan commented May 27, 2017

The reason not having both py3 and py2 TF installed on latest is exactly image size.
I think having python3 installed on latest is simply an oversight.
@caisq maybe we missed some of the image size optimizations?

@jart jart reopened this May 27, 2017
@jart jart added type:build/install Build and install issues and removed type:support Support issues labels May 27, 2017
@ruthyaneth
Copy link

Aqui esta como instalar python, docker, tensorflow, virtualbox
https://youtu.be/OiPjSnKAmSI

@developius
Copy link

Hey I've got a problem relating to this. When I run tensorflow/tensorflow and invoke python, the tensorflow python module appears to not be installed. Am I missing something here?

$ docker image ls --no-trunc | grep tensorflow/tensorflow
REPOSITORY                         TAG                 IMAGE ID                                                                  CREATED             SIZE
tensorflow/tensorflow              latest              sha256:a2d1671e8a9373d617402e49124b78bf4c73ad9171d4cd4aaf272a035c4993d6   9 days ago          1.25GB

$ docker run --rm -ti tensorflow/tensorflow python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow

@gunan
Copy link
Contributor

gunan commented Feb 19, 2018

@developius could you try:

docker pull tensorflow/tensorflow
docker run --rm -ti tensorflow/tensorflow python

The image works ok for me.

@developius
Copy link

That is really weird. The image checksums are the same yet the new one works.

@gunan
Copy link
Contributor

gunan commented Mar 24, 2018

One more data point.
It looks like no matter which python version you try to use, bazel requires us to have python to be able to run any python program, because it inserts the shebang line "/usr/bin/env python".

This means on python2 image, we do not need python3, but on python3 image we need both python2 and python 3.

@gunan gunan assigned angerson and unassigned gunan May 28, 2018
@gunan
Copy link
Contributor

gunan commented May 28, 2018

Reassigning to @angersson as he will work on restructuring some of our docker files.

@angerson angerson added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Jun 2, 2018
@angerson
Copy link
Contributor

angerson commented Aug 7, 2018

This should go away when tensorflow/community#8 gets implemented.

@ddragosd
Copy link

A related question is: why are the images based on python3.5.2 ? Is it just an inherent lib from Ubuntu 16 ? If yes, any concerns to upgrade the Ubuntu version ?

@tensorflowbutler
Copy link
Member

Nagging Assignee @angersson: It has been 44 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

@angerson
Copy link
Contributor

I don't think we're going to be changing anything in the current Dockerfiles for this, but anyone is welcome to make further changes to the Dockerfiles to improve documentation, etc.

@ddragosd We probably are limited to this version. See #23066.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

8 participants