-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Python 3 #8352
Comments
I would be surprised if we could get away with a python3 flag day, so I suspect that any plan would involve supporting both for a while (at least in our published APIs), even if eventually we drop python2. |
Recommend writing the above:
The primary reason to keep support for python 2.7 is because that is Xenial's default. Anyone working on the assumption that the system default is a good baseline for development across many packages will want this (ROS just happens to be such a user). This of course can change when we switch to Bionic beaver (python 3 only), but a consideration would be whether we support the tax of supporting both in the interim. |
ROS officially supports whatever the system default is and actively works on having their core libraries python3 ready (i.e. 2.7 and 3 compatible) as well as publically encouraging others to do so as well. From REP 3:
|
Good points. For Ubuntu, I think it would make sense to keep Drake's Xenial support at python2 only, and only support python3 as of Bionic. We'd still need the source tree to support both, but only certain runtime configurations would be tested with CI. |
Given everything that happened with Homebrew and Python 2/3, this is going to be tricky (and not necessarily dependent on whether we support Python 3 for Mac). |
My personal feeling is that supporting python3 is extremely important, given that python2 will be completely out of support in ~1.5 years. Drake and director are the last two pieces of software I ever use that don't support python3 yet. Fortunately, supporting python2 and 3 simultaneously is much easier than it used to be (difficulty supporting both versions was one of the problems in early releases of python3). The |
Also, problems with homebrew and system python conflicts could be completely eliminated by using python's virtual environments (which are even built-in on python3.5 and above). I can't recommend that highly enough. |
@kevinleestone mentioned that his team is interested in transitioning to Python3 once the surrounding ecosystem is ready, and the teams should strive for Python3 compatible code. He pointed towards Tensorflow as an excellent example of a Python2+3 compatible library, which has the following style guide considerations: https://www.tensorflow.org/community/style_guide#python_2_and_3_compatible |
Quickly spike-tested what it'd take to support both Python2+3. At the Some items that would pave the way:
My guess is it'd be a man week of PEH to fully get it working, and more on top of that to ensure we have flavors of CI covering Python3. Left off here: Still no timeline on this, as I still have it at a relatively low priority. I will see if I can periodically make PRs which slowly make compatibility changes. |
An additional use case library-wise: One of the workarounds is to use the |
Just wanted to +1 for Python3 support. I'm starting to use some libraries that are Python3 only (specifically OpenAI baselines) which is making development pretty difficult. |
Python 3 is next on our TODO list of low priority items after Ubuntu Bionic support, so it will certainly happen in the medium term. |
I am starting to focus on this to see what the challenges may be; this still takes a backseat to Bionic support in general. That being said, we may want to make our story straight with Bionic + Python2 support, e.g. say that Python2 is experimental, and once Python3 comes online, will be the only supported version. |
I think as far as the MIT class is concerned... just need the docker instance (locked on 16.04) to continue to work through the fall with Python 2. |
I don't see any principled reason we'd need to ever officially support Bionic + Python2. If we want to disclaim it as "experimental" for now in order to be able to withdraw it later, I don't object. As to whether going straight to Bionic + Python3 directly is the best plan, that would depend on the details, and I haven't looked enough to know. We'll need some flavor of Bionic + pydrake within the next two weeks. If that can be Python3 that's fine. If we need to have experimental Bionic + Python2 as a transition step, that's fine too. |
Awesome! I have a prototype branch where I just got Need to then make sure I haven't broken Python2, and will then start filtering in the simpler compatibility PRs. UPDATE: Working Python2 + Python3: 962d5fa @jamiesnape Can I ask how we should start handling Python3 dependencies?
Yup! This should keep everything working as-is for Xenial + Python2. |
FWIW Bionic support is marked as "experimental" as a whole (not that "experimental" really means a great deal).
Dependencies are easy enough. I will fix them once we are in a reasonable situation with the Python docs. |
Also, what is the reasoning for the change to medium priority? This was not even the highest low priority item a couple of days ago. This requires a lot of work on CI and distribution infrastructure that isn't going to happen overnight. |
I would also add, that not sure I see much benefit in pure build scripts running in Python 2 on one platform and Python 3 on another. Sure, And if you want to make Mojave Python 3 only, that would be fine. Then we only have to support multiple Pythons for at most a year from now on Mac. |
Given Jeremy's above point, I would like to see if we can move to Python3-only on upcoming platforms (Bionic, Mojave as well), hopefully without any sort of flag day (e.g. before going from experimental to supported), and save on support matrix combinatorics (e.g. trying to do Python2+3 on Xenial+Bionic+Mojave+etc.). I apologize that I hadn't acted on this sooner to incorporate in our prior plans.
Understood that it wouldn't happen overnight; however, I am interested in simplifying our support, if possible. I would be more than up for helping move it forward if we think it's still feasible to do in conjunction with official Bionic support; however, if it is infeasible, I can certainly place the priority back down.
If Bazel provided a better mechanism to run both Python2 and Python3 scripts out of the box as native targets, I'd be up for doing build scripts in Python2, and then consumables in Python2 or Python3. If you think it'd be trivial otherwise, I'd be fine with it, but to me, it seems easiest just to support one Python version, period, on a platform (at least to start)? |
I am talking things that rely on shebang lines. |
EDIT: Moved checklist items to overview. If these land in time, we can consider how to handle the support matrix for Bionic + Py2/Py3. All else, we support both on Bionic? |
Jamie has added some experimental jobs: They are currently failing due to |
Closed by checkbox-ness. |
I believe we've discussed this before, but I'm not sure if it's been captured in a Drake-specific issue. Just writing this down for now, so I've marked it as
priority: low
. It can be upped if need be.Options:
Pros:
@
for matrix multiplication NumPy__*div__
and__*truediv__
(\cc @rdeits)Cons:
/usr/bin/env python2
from/usr/bin/env python2.7
from/usr/bin/env python
)Requires:
pybind11
support -pybind11
itself support Python3; our fork (and related features) supports Python3 because we use the same CI: unique_ptr: Fix ownership issues for failed overloads (RobotLocomotion/drake#8160) pybind11#11 tests - https://travis-ci.org/RobotLocomotion/pybind11/builds/345471530UPDATE (2018/10/06): I am starting to look into this to see what challenges there are.
Current plan of attack:
pydrake
and its testing code (pydrake: Enable testing to pass under Python3 #9613).pycodestyle
has really weird behavior on how it handles getting new functions.buildifer
chokes on certain items.Finish PRs belowPRs in flight:
pydrake
to be py3 compatible, explicit dep onsix
(pydrake: Enable testing to pass under Python3 #9613)PRs to submit:
director
, we should ensure all of its upstream dependencies provide Py2.7 (python3: Support Python2 for lcm when being used by drake_visualizer #9699 I thinkdrake_visualizer: Package private version of LCM binaries #9764, Update drake-visualizer and vtk packages #9938)check_bazel_python
at build-time #10280 Hoistpython_bin_test
check to run at build time (python: Document experimental Python3 support for Bionic #10257 (review))user.bazelrc
indrake-shambhala
, propagate to CI stuffProject roadmap for primary Python 2 -> 3 support (Ubuntu + ROS, Mac)Will not block closing this issue based on this.EDIT (2018/11/21): I believe our goal is to support Python3 around mid-December.
EDIT (2018/12/10): Targeting before the holidays (possibly past mid-December).
\cc @RussTedrake
The text was updated successfully, but these errors were encountered: