Skip to content

Add support for Python 3.10#21221

Merged
jjyao merged 1 commit intoray-project:masterfrom
acxz:py310
Aug 26, 2022
Merged

Add support for Python 3.10#21221
jjyao merged 1 commit intoray-project:masterfrom
acxz:py310

Conversation

@acxz
Copy link
Copy Markdown
Contributor

@acxz acxz commented Dec 21, 2021

Why are these changes needed?

Add python 3.10 support.

Related issue number

Closes #19116

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@acxz acxz marked this pull request as draft December 21, 2021 16:44
@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Dec 21, 2021

This PR is just pushing 3.10 changes through our CI pipeline.

Locally for me, the build is failing at some cython issue. I'll keep debugging and post logs/errors as I encounter/fix them.

@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Dec 21, 2021

My local build issues:

    Execution platform: @local_config_platform//:host

    Use --sandbox_debug to see verbose messages from the sandbox
    In file included from bazel-out/k8-opt/bin/external/local_config_python/_python3/_python3_include/Python.h:74,
                     from bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:4:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp: In function ‘void __pyx_tp_dealloc_3ray_9streaming_10_streaming_ReaderClient(PyObject*)’:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22254:7: error: lvalue required as increment operand
    22254 |     ++Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22256:7: error: lvalue required as decrement operand
    22256 |     --Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp: In function ‘void __pyx_tp_dealloc_3ray_9streaming_10_streaming_WriterClient(PyObject*)’:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22363:7: error: lvalue required as increment operand
    22363 |     ++Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22365:7: error: lvalue required as decrement operand
    22365 |     --Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp: In function ‘void __pyx_tp_dealloc_3ray_9streaming_10_streaming_DataWriter(PyObject*)’:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22468:7: error: lvalue required as increment operand
    22468 |     ++Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22470:7: error: lvalue required as decrement operand
    22470 |     --Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp: In function ‘void __pyx_tp_dealloc_3ray_9streaming_10_streaming_DataReader(PyObject*)’:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22582:7: error: lvalue required as increment operand
    22582 |     ++Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22584:7: error: lvalue required as decrement operand
    22584 |     --Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp: In function ‘void __pyx_tp_dealloc_array(PyObject*)’:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22715:7: error: lvalue required as increment operand
    22715 |     ++Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:22717:7: error: lvalue required as decrement operand
    22717 |     --Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp: In function ‘void __pyx_tp_dealloc_memoryview(PyObject*)’:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:23026:7: error: lvalue required as increment operand
    23026 |     ++Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:23028:7: error: lvalue required as decrement operand
    23028 |     --Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp: In function ‘void __pyx_tp_dealloc__memoryviewslice(PyObject*)’:
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:23276:7: error: lvalue required as increment operand
    23276 |     ++Py_REFCNT(o);
          |       ^~~~~~~~~
    bazel-out/k8-opt/bin/python/ray/streaming/_streaming.cpp:23278:7: error: lvalue required as decrement operand
    23278 |     --Py_REFCNT(o);
          |       ^~~~~~~~~
    INFO: Elapsed time: 1066.648s, Critical Path: 222.15s
    INFO: 3394 processes: 1184 internal, 2206 linux-sandbox, 4 local.
    FAILED: Build did NOT complete successfully
    FAILED: Build did NOT complete successfully

@jjyao
Copy link
Copy Markdown
Contributor

jjyao commented Dec 21, 2021

What's the compiler?

@pcmoritz
Copy link
Copy Markdown
Contributor

Interesting, this should have been fixed in cython/cython@d8e93b3.

We probably need to bump

url = "https://github.com/cython/cython/archive/26cb654dcf4ed1b1858daf16b39fd13406b1ac64.tar.gz",
to a newer commit.

@pcmoritz
Copy link
Copy Markdown
Contributor

pcmoritz commented Dec 21, 2021

@acxz Do you want to try doing that locally to see if that fixes it and submit a PR for it?

@acxz acxz mentioned this pull request Dec 22, 2021
6 tasks
@acxz acxz marked this pull request as ready for review December 23, 2021 00:15
@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Dec 23, 2021

Thx for the suggestion @pcmoritz . I can now build locally just fine.

There are still some errors in the CI (https://buildkite.com/ray-project/ray-builders-pr/builds/21321#88be7f42-19bb-42c8-ad3f-b8232bb9be21) and of course #16599

@pcmoritz
Copy link
Copy Markdown
Contributor

Thanks, this is exciting :)

@simon-mo How much work is it to activate 3.10 support for the macOS build pipeline?

@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Dec 26, 2021

One error is currently due to a timeout and another error is due to unavailable packages in the anaconda distribution for python 310 (needed for building the py310 wheels).

@simon-mo
Copy link
Copy Markdown
Contributor

simon-mo commented Jan 3, 2022

👋 I and add Python 3.10 to macOS pipeline.

@simon-mo
Copy link
Copy Markdown
Contributor

simon-mo commented Jan 3, 2022

another error is due to unavailable packages in the anaconda distribution for python 310
@acxz can we install those via pip instead?

@jjyao
Copy link
Copy Markdown
Contributor

jjyao commented Jan 3, 2022

@acxz Do we need to upgrade the grpc version since grpc/grpc#28392 is merged.

@simon-mo
Copy link
Copy Markdown
Contributor

simon-mo commented Jan 3, 2022

added. Here's the change for CI infra

diff --git a/ci-macos-experiments/data/userdata.tmpl b/ci-macos-experiments/data/userdata.tmpl
index 96cfb6a..2c59d79 100644
--- a/ci-macos-experiments/data/userdata.tmpl
+++ b/ci-macos-experiments/data/userdata.tmpl
@@ -27,17 +27,20 @@ install_pythons() {
   DOWNLOAD_DIR=/tmp/python_downloads
 
   PY_VERSIONS=("3.6.2"
-              "3.7.0"
-              "3.8.2"
-              "3.9.1")
+               "3.7.0"
+               "3.8.2"
+               "3.9.1"
+               "3.10.1")
   PY_INSTS=("python-3.6.2-macosx10.6.pkg"
             "python-3.7.0-macosx10.6.pkg"
             "python-3.8.2-macosx10.9.pkg"
-            "python-3.9.1-macosx10.9.pkg")
+            "python-3.9.1-macosx10.9.pkg"
+            "python-3.10.1-macos11.pkg")
   PY_MMS=("3.6"
           "3.7"
           "3.8"
-          "3.9")
+          "3.9"
+          "3.10")
 
   mkdir -p $DOWNLOAD_DIR
 
diff --git a/ci-macos-module/data/userdata.tmpl b/ci-macos-module/data/userdata.tmpl
index 76ba812..b4fabc0 100644
--- a/ci-macos-module/data/userdata.tmpl
+++ b/ci-macos-module/data/userdata.tmpl
@@ -27,17 +27,20 @@ install_pythons() {
   DOWNLOAD_DIR=/tmp/python_downloads
 
   PY_VERSIONS=("3.6.2"
-              "3.7.0"
-              "3.8.2"
-              "3.9.1")
+               "3.7.0"
+               "3.8.2"
+               "3.9.1"
+               "3.10.1")
   PY_INSTS=("python-3.6.2-macosx10.6.pkg"
             "python-3.7.0-macosx10.6.pkg"
             "python-3.8.2-macosx10.9.pkg"
-            "python-3.9.1-macosx10.9.pkg")
+            "python-3.9.1-macosx10.9.pkg"
+            "python-3.10.1-macos11.pkg")
   PY_MMS=("3.6"
           "3.7"
           "3.8"
-          "3.9")
+          "3.9"
+          "3.10")
 
   mkdir -p $DOWNLOAD_DIR
 

you can make the corresponding change here:

PY_VERSIONS=("3.6.2"

@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Jan 19, 2022

@acxz Do we need to upgrade the grpc version since grpc/grpc#28392 is merged.

@jjyao great idea I can make a separate PR for the update to grpc specifically.

#21866

@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Jan 19, 2022

added. Here's the change for CI infra

@simon-mo thx for this suggestion, added to the commit. Also realized I had forgotten to update the build-wheels of manylinux2014.sh.

can we install those via pip instead?

I think so, let me look at the new build logs and see whats up again.

@acxz acxz mentioned this pull request Jan 25, 2022
6 tasks
@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Jan 25, 2022

@simon-mo

let me look at the new build logs and see whats up again.

it seems like rn most tests are failing due to the error that #21866 resolves. We'll have to merge that PR first before I can see more errors from the CI.

@bveeramani
Copy link
Copy Markdown
Member

‼️ ACTION REQUIRED ‼️

We've switched our code formatter from YAPF to Black (see #21311).

To prevent issues with merging your code, here's what you'll need to do:

  1. Install Black
pip install -I black==21.12b0
  1. Format changed files with Black
curl -o format-changed.sh https://gist.githubusercontent.com/bveeramani/42ef0e9e387b755a8a735b084af976f2/raw/7631276790765d555c423b8db2b679fd957b984a/format-changed.sh
chmod +x ./format-changed.sh
./format-changed.sh
rm format-changed.sh
  1. Commit your changes.
git add --all
git commit -m "Format Python code with Black"
  1. Merge master into your branch.
git pull upstream master
  1. Resolve merge conflicts (if necessary).

After running these steps, you'll have the updated format.sh.

@amogkam amogkam mentioned this pull request Feb 10, 2022
2 tasks
rkooo567 pushed a commit that referenced this pull request Feb 15, 2022
add patch for newer setuptools, can be removed once grpc 1.44 is release

Why are these changes needed?
With grpc updated to 1.43, one of the patches is not needed.

Patch needed when building locally for newer setuptools version. See grpc/grpc#28392 for more details.
Also needed as a prereq to #21221
@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Feb 16, 2022

tests failing at installing blist: https://buildkite.com/ray-project/ray-builders-pr/builds/24559#dde8ef71-9bae-4621-9088-8318c6fb562a/6-10240

Looks like blist is p dead and we have removed it from other parts of the repo. (ba0f531) Going ahead and removing it from the test suite as well.

@simon-mo
Copy link
Copy Markdown
Contributor

Looks like blist is p dead and we have removed it from other parts of the repo. (ba0f531) Going ahead and removing it from the test suite as well.

Sounds good!

@acxz acxz requested a review from a team as a code owner August 9, 2022 23:30
Signed-off-by: acxz <17132214+acxz@users.noreply.github.com>
@acxz acxz mentioned this pull request Aug 19, 2022
2 tasks
@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Aug 19, 2022

@simon-mo @rkooo567 @pcmoritz @wuisawesome @scv119 @amogkam @krfricke

Sorry for pinging all of you folks, but it has been a month since the blocking pytest issue has been cleared and this PR has seen no closure from the Ray Team, besides just redirecting the responsibility to other members of the team. Can we at least get some closure for this PR?

The issues that are appearing currently in the CI, I believe are flaky and I have not seem these specific errors throughout the past year this PR has been open.

@zhe-thoughts
Copy link
Copy Markdown
Contributor

Thanks @acxz for the feedback. We will prioritize this in the next couple of days

@scv119 scv119 added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label Aug 22, 2022
@scv119
Copy link
Copy Markdown
Contributor

scv119 commented Aug 22, 2022

test failures looks unrelated.

@zhe-thoughts
Copy link
Copy Markdown
Contributor

@scv119 let's merge this? Thanks

@scv119
Copy link
Copy Markdown
Contributor

scv119 commented Aug 26, 2022

@amogkam @krfricke @richard4912 can code owner approve this?

@jjyao jjyao merged commit 96d579a into ray-project:master Aug 26, 2022
@acxz
Copy link
Copy Markdown
Contributor Author

acxz commented Aug 26, 2022

Woot Woot!

Thanks everyone!

@acxz acxz deleted the py310 branch August 26, 2022 18:03
@jjyao
Copy link
Copy Markdown
Contributor

jjyao commented Aug 26, 2022

Thanks for the amazing work @acxz!

@fehrin1
Copy link
Copy Markdown

fehrin1 commented Sep 7, 2022

At least for Windows this is not resolved, with Python 3.10 on Windows 10 20H2 i get
pip install -U ray
ERROR: Could not find a version that satisfies the requirement ray (from versions: none)
ERROR: No matching distribution found for ray
Is there any progress (to be expected)?
python --version
Python 3.10.7
https://www.python.org/downloads/release/python-3107

@fehrin1
Copy link
Copy Markdown

fehrin1 commented Sep 7, 2022

What works is
pip install -U ray-cpp
Collecting ray-cpp
Downloading ray_cpp-2.0.0-cp310-cp310-win_amd64.whl (18.5 MB)
But this is still not ray.

@fehrin1
Copy link
Copy Markdown

fehrin1 commented Sep 7, 2022

On https://pypi.org/project/ray/#files i can see there are cp310 packages for Linux and MacOS but not for Windows, are they to be supplied in the foreseeable future?

@rickyyx
Copy link
Copy Markdown
Member

rickyyx commented Dec 28, 2022

Missing wheel for python 310 on window is fixed in release process and uploaded to pypi for ray 2.2.0. https://pypi.org/project/ray/2.2.0/#files

@duburcqa
Copy link
Copy Markdown
Contributor

Nice, well done. Python 3.11 still missing but we are getting there :)

@rickyyx
Copy link
Copy Markdown
Member

rickyyx commented Dec 28, 2022

Nice, well done. Python 3.11 still missing but we are getting there :)

@duburcqa Yes, that is tracked here #27881

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

Labels

tests-ok The tagger certifies test failures are unrelated and assumes personal liability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Python 3.10 wheel