Add support for Python 3.x #1

Closed
mrry opened this Issue Nov 9, 2015 · 48 comments

Comments

Projects
None yet
@mrry
Contributor

mrry commented Nov 9, 2015

Currently we only support Python 2.7, but we should support Python 3.

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 9, 2015

Contributor

Main things this involves: print -> print(), handle __floordiv__ / __truediv__ / __div__ correctly.

Contributor

girving commented Nov 9, 2015

Main things this involves: print -> print(), handle __floordiv__ / __truediv__ / __div__ correctly.

@cdnsteve

This comment has been minimized.

Show comment
Hide comment
@cdnsteve

cdnsteve Nov 9, 2015

👍 to this issue

cdnsteve commented Nov 9, 2015

👍 to this issue

@dvbuntu

This comment has been minimized.

Show comment
Hide comment
@dvbuntu

dvbuntu Nov 9, 2015

Contributor

👍

Contributor

dvbuntu commented Nov 9, 2015

👍

@ashwin31

This comment has been minimized.

Show comment
Hide comment

ashwin31 commented Nov 9, 2015

👍

@girving girving self-assigned this Nov 9, 2015

@joestepp

This comment has been minimized.

Show comment
Hide comment

joestepp commented Nov 9, 2015

👍

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 9, 2015

Contributor

We're working on it.

Contributor

girving commented Nov 9, 2015

We're working on it.

@kevinaloys

This comment has been minimized.

Show comment
Hide comment
@kevinaloys

kevinaloys Nov 9, 2015

Python 3 is a must have. 👍

Python 3 is a must have. 👍

@mgcdanny

This comment has been minimized.

Show comment
Hide comment
@mgcdanny

mgcdanny Nov 9, 2015

How do we contribute towards python3 support? Are there any specific tickets open? Is there a python3 development branch?

mgcdanny commented Nov 9, 2015

How do we contribute towards python3 support? Are there any specific tickets open? Is there a python3 development branch?

@cdnsteve

This comment has been minimized.

Show comment
Hide comment
@cdnsteve

cdnsteve Nov 9, 2015

@mgcdanny seems they require contributors to sign an agreement first.
https://github.com/tensorflow/tensorflow/blob/master/CONTRIBUTING.md

cdnsteve commented Nov 9, 2015

@mgcdanny seems they require contributors to sign an agreement first.
https://github.com/tensorflow/tensorflow/blob/master/CONTRIBUTING.md

@MikalaiDrabovich

This comment has been minimized.

Show comment
Hide comment
@MikalaiDrabovich

MikalaiDrabovich Nov 9, 2015

Contributor

👍

Contributor

MikalaiDrabovich commented Nov 9, 2015

👍

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 10, 2015

Contributor

I'm running futurize on the code at the moment; once that's done it'll be easier to parallelize the remaining work. So far futurize --stage1 is checked in and I'm working through futurize --stage2 now (checking each of our divisions very carefully :)).

Unfortunately our contribution process needs a bit of improvement (we're working on streamlining it), but I'll see if there are natural chunks of work to break off and ask for help in fixing once the initial futurize push is done. Before that it's tricky to parallelize.

The only non-obvious questions (so far) are what to do with unicode and where. Cc'ing @mrry since he was taking a look at that. Most of the "names" for things, such as names for ops and names for tensors in a graph, are already restricted to be roughly alphanumeric, so hopefully we should be able to leave them as C++ string while still accepting unicode input from Python.

Contributor

girving commented Nov 10, 2015

I'm running futurize on the code at the moment; once that's done it'll be easier to parallelize the remaining work. So far futurize --stage1 is checked in and I'm working through futurize --stage2 now (checking each of our divisions very carefully :)).

Unfortunately our contribution process needs a bit of improvement (we're working on streamlining it), but I'll see if there are natural chunks of work to break off and ask for help in fixing once the initial futurize push is done. Before that it's tricky to parallelize.

The only non-obvious questions (so far) are what to do with unicode and where. Cc'ing @mrry since he was taking a look at that. Most of the "names" for things, such as names for ops and names for tensors in a graph, are already restricted to be roughly alphanumeric, so hopefully we should be able to leave them as C++ string while still accepting unicode input from Python.

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 10, 2015

Contributor

Also, question for people that have done such conversions before / recently: is six still the recommended way to make code transparently support both? In particular, we need stuff like xrange and iteritems as symbols that exist in both 2.7 and 3.x.

Contributor

girving commented Nov 10, 2015

Also, question for people that have done such conversions before / recently: is six still the recommended way to make code transparently support both? In particular, we need stuff like xrange and iteritems as symbols that exist in both 2.7 and 3.x.

@madisonmay

This comment has been minimized.

Show comment
Hide comment
@madisonmay

madisonmay Nov 10, 2015

@girving I would follow the guide written by python3 core dev Brett Cannon: https://docs.python.org/3.5/howto/pyporting.html. He's been heavily involved with the push to move existing libs to python3.

@girving I would follow the guide written by python3 core dev Brett Cannon: https://docs.python.org/3.5/howto/pyporting.html. He's been heavily involved with the push to move existing libs to python3.

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 10, 2015

Contributor

@madisonmay: Thanks, should have asked you earlier. Modernize probably would have been a better choice, since after reading that page I am essentially taking the output of futurize and then rewriting it into what modernize might have already spit out. Mostly done with that phase, though, so I'll probably just finish it up using futurize.

For the record: futurize --stage was mostly print_function and a few other safe trivialities. I'll write a detailed comment on what futurize --stage2 involved for us once I'm done with it (still in the middle of reading diffs).

Contributor

girving commented Nov 10, 2015

@madisonmay: Thanks, should have asked you earlier. Modernize probably would have been a better choice, since after reading that page I am essentially taking the output of futurize and then rewriting it into what modernize might have already spit out. Mostly done with that phase, though, so I'll probably just finish it up using futurize.

For the record: futurize --stage was mostly print_function and a few other safe trivialities. I'll write a detailed comment on what futurize --stage2 involved for us once I'm done with it (still in the middle of reading diffs).

@yuncliu

This comment has been minimized.

Show comment
Hide comment

yuncliu commented Nov 10, 2015

+1

@Peque

This comment has been minimized.

Show comment
Hide comment
@Peque

Peque Nov 10, 2015

I think it is pretty clear that there are many people interested in this issue. However, I would suggest users to use the Subscribe button instead of adding a new 👍.

screenshot from 2015-11-10 10-36-53

This way developers (and all subscribed users) can get notifications on useful future updates. 😉

PS: If you already posted a 👍 you might as well consider removing it to keep the discussion cleaner.

Peque commented Nov 10, 2015

I think it is pretty clear that there are many people interested in this issue. However, I would suggest users to use the Subscribe button instead of adding a new 👍.

screenshot from 2015-11-10 10-36-53

This way developers (and all subscribed users) can get notifications on useful future updates. 😉

PS: If you already posted a 👍 you might as well consider removing it to keep the discussion cleaner.

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 10, 2015

Contributor

Thank you @Peque! It would be great if further comments were limited to technical discussions about Python 3 support.

Contributor

girving commented Nov 10, 2015

Thank you @Peque! It would be great if further comments were limited to technical discussions about Python 3 support.

@goodmami

This comment has been minimized.

Show comment
Hide comment
@goodmami

goodmami Nov 11, 2015

From the README:

The TensorFlow Python API currently requires Python 2.7:
we are working on adding support for Python 3.0.

If you require 2.7 for the 2.X line, then why restrict yourselves to 3.0 (which was released about the time of 2.6)? If you target 3.3+, then you'll save yourselves a lot of headache, especially if you're using u'あ' unicode strings. (also see unicode_literals).

And 👍 for six for more complicated things.

From the README:

The TensorFlow Python API currently requires Python 2.7:
we are working on adding support for Python 3.0.

If you require 2.7 for the 2.X line, then why restrict yourselves to 3.0 (which was released about the time of 2.6)? If you target 3.3+, then you'll save yourselves a lot of headache, especially if you're using u'あ' unicode strings. (also see unicode_literals).

And 👍 for six for more complicated things.

@vrv

This comment has been minimized.

Show comment
Hide comment
@vrv

vrv Nov 11, 2015

Contributor

Sorry, I meant Python 3, not 3.0 -- was in a rush to fix :P. I'll fix this today

Contributor

vrv commented Nov 11, 2015

Sorry, I meant Python 3, not 3.0 -- was in a rush to fix :P. I'll fix this today

@girving girving changed the title from Add support for Python 3 to Add support for Python 3.x Nov 11, 2015

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 11, 2015

Contributor

@goodmami: Yes, we will likely only support 3.3+, possibly 3.4+ (I'm not sure what the differences are, but will look that up). I also changed the issue title.

Contributor

girving commented Nov 11, 2015

@goodmami: Yes, we will likely only support 3.3+, possibly 3.4+ (I'm not sure what the differences are, but will look that up). I also changed the issue title.

@jli05

This comment has been minimized.

Show comment
Hide comment
@jli05

jli05 Nov 11, 2015

I'd really like you support from 3.3 up to the latest release of Python (currently 3.5; then 4.0 in the future). This piece of software is going to be the heart of many things in human life in the future.

jli05 commented Nov 11, 2015

I'd really like you support from 3.3 up to the latest release of Python (currently 3.5; then 4.0 in the future). This piece of software is going to be the heart of many things in human life in the future.

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 12, 2015

Contributor

@jli05: https://docs.python.org/3/whatsnew/3.4.html makes it look like supporting 3.3 won't be any harder than 3.4, so we should be good to go. It is possible our internal tests will be run only in 3.4 (and 2.7), but if anything ever breaks we'll be happy to accept patches.

Contributor

girving commented Nov 12, 2015

@jli05: https://docs.python.org/3/whatsnew/3.4.html makes it look like supporting 3.3 won't be any harder than 3.4, so we should be good to go. It is possible our internal tests will be run only in 3.4 (and 2.7), but if anything ever breaks we'll be happy to accept patches.

@leondz leondz referenced this issue in leondz/entity_recognition Nov 12, 2015

Open

Add support for LSTM #10

@6iloveyou

This comment has been minimized.

Show comment
Hide comment
@6iloveyou

6iloveyou Nov 12, 2015

@girving now this version support python3.4 ??

@girving now this version support python3.4 ??

@AFZL95

This comment has been minimized.

Show comment
Hide comment
@AFZL95

AFZL95 Nov 12, 2015

i look forward to that progress!

AFZL95 commented Nov 12, 2015

i look forward to that progress!

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 12, 2015

Contributor

We don't support 3.x yet, but we're getting closer. As of 1d76583, all our Python files import absolute_import, division, and print_function from __future__, and Tensor objects have the correct suite of division operators for compatibility with 2.7 and 3.x. This involved running futurize and them inspecting every call to division to see whether it should be / or //. I've also scrubbed all of our uses of xrange / range / zip / map / similar.

Next steps: set up testing with 3.x, deal with unicode correctly, fix imports for libraries that have moved around, etc.

Contributor

girving commented Nov 12, 2015

We don't support 3.x yet, but we're getting closer. As of 1d76583, all our Python files import absolute_import, division, and print_function from __future__, and Tensor objects have the correct suite of division operators for compatibility with 2.7 and 3.x. This involved running futurize and them inspecting every call to division to see whether it should be / or //. I've also scrubbed all of our uses of xrange / range / zip / map / similar.

Next steps: set up testing with 3.x, deal with unicode correctly, fix imports for libraries that have moved around, etc.

@benhamner

This comment has been minimized.

Show comment
Hide comment
@benhamner

benhamner Nov 14, 2015

I want to add TensorFlow to Kaggle Scripts, where we only support Python 3. Do you have an estimated timeframe of getting to Python 3 support (a couple days? a week? a month?).

I want to add TensorFlow to Kaggle Scripts, where we only support Python 3. Do you have an estimated timeframe of getting to Python 3 support (a couple days? a week? a month?).

@girving

This comment has been minimized.

Show comment
Hide comment
@girving

girving Nov 15, 2015

Contributor

We're most of the way there: all the hard bits are hopefully done and only build issues and occasional incompatibilities remain. I don't have a timeline though.

Contributor

girving commented Nov 15, 2015

We're most of the way there: all the hard bits are hopefully done and only build issues and occasional incompatibilities remain. I don't have a timeline though.

rmlarsen added a commit that referenced this issue Feb 7, 2018

martinwicke pushed a commit that referenced this issue Feb 20, 2018

martinwicke pushed a commit that referenced this issue Feb 22, 2018

martinwicke pushed a commit that referenced this issue Feb 22, 2018

whchung referenced this issue in ROCmSoftwarePlatform/tensorflow-upstream Apr 10, 2018

Merge pull request #1 from ROCmSoftwarePlatform/rocm-v1-readme-updates
Update ROCm.md with a known issues / workaround section

av8ramit pushed a commit that referenced this issue Apr 30, 2018

Rbiessy pushed a commit to Rbiessy/tensorflow that referenced this issue Jun 15, 2018

Merge pull request #1 from Rbiessy/update_sycl_1_2_1
[SYCL] Update to SYCL 1.2.1

@velconia velconia referenced this issue in PaddlePaddle/Paddle Jul 9, 2018

Open

Add support for Python 3.x #12040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment