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

Remove python 3.6 support [1/n] #34373

Merged
merged 2 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .buildkite/pipeline.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,6 @@
python/ray/serve/test_gradio
python/ray/serve/test_gradio_visualization


- label: ":python: Minimal install 3.6"
conditions: ["RAY_CI_PYTHON_AFFECTED"]
instance_size: medium
commands:
- cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
- ./ci/ci.sh test_minimal 3.6
- ./ci/ci.sh test_latest_core_dependencies 3.6

- label: ":python: Minimal install 3.7"
conditions: ["RAY_CI_PYTHON_AFFECTED"]
instance_size: medium
Expand Down Expand Up @@ -626,24 +617,6 @@
- bazel test --config=ci $(./ci/run/bazel_export_options) --build_tests_only --test_tag_filters=minimal python/ray/train/...


- label: ":cold_face: :python: Ray Python 3.6 ML compatibility tests"
conditions:
["ALWAYS", "RAY_CI_TUNE_AFFECTED", "RAY_CI_TRAIN_AFFECTED", "RAY_CI_ML_AFFECTED", ]
instance_size: large
commands:
- cleanup() { if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then ./ci/build/upload_build_info.sh; fi }; trap cleanup EXIT
- ./ci/env/install-minimal.sh 3.6
- pip install -r python/requirements/compat/requirements_py36_compat.txt
- pip install -U typing-extensions
- HOROVOD_WITH_GLOO=1 HOROVOD_WITHOUT_MPI=1 HOROVOD_WITHOUT_MXNET=1 HOROVOD_WITH_TENSORFLOW=1 HOROVOD_WITH_PYTORCH=1 pip install horovod
- ./ci/env/env_info.sh
- bazel test --config=ci $(./scripts/bazel_export_options) --test_tag_filters=compat_py36
python/ray/tests/horovod/...
python/ray/tests/lightgbm/...
python/ray/tests/ml_py36_compat/...
python/ray/tests/xgboost/...


- label: ":cold_face: :python: Ray Python legacy dependency ML compatibility tests"
conditions:
["RAY_CI_PYTHON_DEPENDENCIES_AFFECTED", "RAY_CI_TUNE_AFFECTED", "RAY_CI_TRAIN_AFFECTED", "RAY_CI_ML_AFFECTED"]
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipeline.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ prelude_commands: &prelude_commands |-
if [ "${BUILDKITE_PULL_REQUEST}" = "false" ]; then export BUILDKITE_GIT_REF=${BUILDKITE_COMMIT}; else export BUILDKITE_GIT_REF=refs/pull/${BUILDKITE_PULL_REQUEST}/head; fi
git fetch -v --prune -- origin ${BUILDKITE_GIT_REF}
git checkout -f ${BUILDKITE_COMMIT}
export PYTHON="3.6"
export PYTHON="3.7"
export RAY_USE_RANDOM_PORTS="1"
export RAY_DEFAULT_BUILD="1"
export LC_ALL="en_US.UTF-8"
Expand Down
4 changes: 1 addition & 3 deletions ci/build/build-docker-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
}

PY_MATRIX = {
"py36": "3.6",
"py37": "3.7",
"py38": "3.8",
"py39": "3.9",
Expand Down Expand Up @@ -397,7 +396,6 @@ def prep_ray_ml():
# We don't need these in the ml docker image
ignore_requirements = [
"python/requirements/compat/requirements_legacy_compat.txt",
"python/requirements/compat/requirements_py36_compat.txt",
]

files_on_disk = glob.glob(f"{root_dir}/python/**/requirements*.txt", recursive=True)
Expand Down Expand Up @@ -715,7 +713,7 @@ def push_readmes(merge_build: bool):
type=click.Choice(list(PY_MATRIX.keys())),
multiple=True,
help="Which python versions to build. "
"Must be in (py36, py37, py38, py39, py310, py311)",
"Must be in (py37, py38, py39, py310, py311)",
)
@click.option(
"--device-types",
Expand Down
10 changes: 4 additions & 6 deletions ci/build/test-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ function retry {

if [[ "$platform" == "linux" ]]; then
# Install miniconda.
PY_WHEEL_VERSIONS=("36" "37" "38" "39")
PY_MMS=("3.6.13"
"3.7.10"
PY_WHEEL_VERSIONS=("37" "38" "39")
PY_MMS=("3.7.10"
"3.8.10"
"3.9.5")
wget --quiet "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" -O miniconda3.sh
Expand Down Expand Up @@ -103,9 +102,8 @@ elif [[ "$platform" == "macosx" ]]; then
"3.10"
)
else
PY_WHEEL_VERSIONS=("36" "37" "38" "39" "310")
PY_MMS=("3.6"
"3.7"
PY_WHEEL_VERSIONS=("37" "38" "39" "310")
PY_MMS=("3.7"
"3.8"
"3.9"
"3.10"
Expand Down
4 changes: 1 addition & 3 deletions ci/env/install-minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
if [ -z "$1" ]; then
PYTHON_VERSION=${PYTHON-3.7}
else
if [ "$1" = "3.6" ]; then
PYTHON_VERSION="3.6"
elif [ "$1" = "3.7" ]; then
if [ "$1" = "3.7" ]; then
PYTHON_VERSION="3.7"
elif [ "$1" = "3.8" ]; then
PYTHON_VERSION="3.8"
Expand Down
7 changes: 1 addition & 6 deletions ci/lint/clang-tidy-diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@
except ImportError:
yaml = None

is_py2 = sys.version[0] == "2"

if is_py2:
import Queue as queue
else:
import queue as queue
import queue as queue


def run_tidy(task_queue, lock, timeout):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ The maximum number of workers the cluster will have at any given time.
``upscaling_speed``
~~~~~~~~~~~~~~~~~~~

The number of nodes allowed to be pending as a multiple of the current number of nodes. For example, if set to 1.0, the cluster can grow in size by at most 100% at any time, so if the cluster currently has 20 nodes, at most 20 pending launches are allowed. Note that although the autoscaler will scale down to `min_workers` (which could be 0), it will always scale up to 5 nodes at a minimum when scaling up.
The number of nodes allowed to be pending as a multiple of the current number of nodes. For example, if set to 1.0, the cluster can grow in size by at most 100% at any time, so if the cluster currently has 20 nodes, at most 20 pending launches are allowed. Note that although the autoscaler will scale down to `min_workers` (which could be 0), it will always scale up to 5 nodes at a minimum when scaling up.

* **Required:** No
* **Importance:** Medium
Expand Down Expand Up @@ -469,7 +469,7 @@ A list of commands to run to set up nodes. These commands will always run on the
# Default setup_commands:
setup_commands:
- echo 'export PATH="$HOME/anaconda3/envs/tensorflow_p36/bin:$PATH"' >> ~/.bashrc
- pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp36-cp36m-manylinux2014_x86_64.whl
- pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp37-cp37m-manylinux2014_x86_64.whl

- Setup commands should ideally be *idempotent* (i.e., can be run multiple times without changing the result); this allows Ray to safely update nodes after they have been created. You can usually make commands idempotent with small modifications, e.g. ``git clone foo`` can be rewritten as ``test -e foo || git clone foo`` which checks if the repo is already cloned first.

Expand Down Expand Up @@ -1123,7 +1123,7 @@ A list of commands to run to set up worker nodes of this type. These commands wi
* **Required:** No
* **Importance:** High
* **Type:** Integer

.. _cluster-configuration-object-store-memory:

``available_node_types.<node_type_name>.node_type.resources.object-store-memory``
Expand Down
21 changes: 8 additions & 13 deletions doc/source/ray-overview/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ You can install the nightly Ray wheels via the following links. These daily rele

.. tabbed:: Linux

=============================================== ================================================
Linux (x86_64) Linux (arm64/aarch64)
=============================================== ================================================
`Linux Python 3.10 (x86_64)`_ `Linux Python 3.10 (aarch64)`_
`Linux Python 3.9 (x86_64)`_ `Linux Python 3.9 (aarch64)`_
`Linux Python 3.8 (x86_64)`_ `Linux Python 3.8 (aarch64)`_
`Linux Python 3.7 (x86_64)`_ `Linux Python 3.7 (aarch64)`_
`Linux Python 3.6 (x86_64)`_ `Linux Python 3.6 (aarch64)`_
=============================================== ================================================
Linux (x86_64) Linux (arm64/aarch64)
=============================================== ================================================
`Linux Python 3.10 (x86_64)`_ `Linux Python 3.10 (aarch64)`_
`Linux Python 3.9 (x86_64)`_ `Linux Python 3.9 (aarch64)`_
`Linux Python 3.8 (x86_64)`_ `Linux Python 3.8 (aarch64)`_
`Linux Python 3.7 (x86_64)`_ `Linux Python 3.7 (aarch64)`_
`Linux Python 3.11 (x86_64) (EXPERIMENTAL)`_ `Linux Python 3.11 (aarch64) (EXPERIMENTAL)`_
=============================================== ================================================
=============================================== ================================================

.. tabbed:: MacOS

Expand All @@ -72,7 +71,6 @@ You can install the nightly Ray wheels via the following links. These daily rele
`MacOS Python 3.9 (x86_64)`_ `MacOS Python 3.9 (arm64)`_
`MacOS Python 3.8 (x86_64)`_ `MacOS Python 3.8 (arm64)`_
`MacOS Python 3.7 (x86_64)`_
`MacOS Python 3.6 (x86_64)`_
================================ ================================

.. tabbed:: Windows (beta)
Expand Down Expand Up @@ -105,21 +103,18 @@ You can install the nightly Ray wheels via the following links. These daily rele
.. _`Linux Python 3.9 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp39-cp39-manylinux2014_x86_64.whl
.. _`Linux Python 3.8 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp38-cp38-manylinux2014_x86_64.whl
.. _`Linux Python 3.7 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp37-cp37m-manylinux2014_x86_64.whl
.. _`Linux Python 3.6 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp36-cp36m-manylinux2014_x86_64.whl

.. _`Linux Python 3.11 (aarch64) (EXPERIMENTAL)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp311-cp311-manylinux2014_aarch64.whl
.. _`Linux Python 3.10 (aarch64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp310-cp310-manylinux2014_aarch64.whl
.. _`Linux Python 3.9 (aarch64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp39-cp39-manylinux2014_aarch64.whl
.. _`Linux Python 3.8 (aarch64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp38-cp38-manylinux2014_aarch64.whl
.. _`Linux Python 3.7 (aarch64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp37-cp37m-manylinux2014_aarch64.whl
.. _`Linux Python 3.6 (aarch64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp36-cp36m-manylinux2014_aarch64.whl


.. _`MacOS Python 3.10 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp310-cp310-macosx_10_15_universal2.whl
.. _`MacOS Python 3.9 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp39-cp39-macosx_10_15_x86_64.whl
.. _`MacOS Python 3.8 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp38-cp38-macosx_10_15_x86_64.whl
.. _`MacOS Python 3.7 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp37-cp37m-macosx_10_15_intel.whl
.. _`MacOS Python 3.6 (x86_64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp36-cp36m-macosx_10_15_intel.whl


.. _`MacOS Python 3.10 (arm64)`: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp310-cp310-macosx_11_0_arm64.whl
Expand Down
1 change: 0 additions & 1 deletion docker/retag-lambda/python_versions.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
py36
py37
py38
py39
Expand Down
10 changes: 3 additions & 7 deletions python/build-wheel-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,23 @@ MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
DOWNLOAD_DIR=python_downloads

NODE_VERSION="14"
PY_VERSIONS=("3.6.2"
"3.7.0"
PY_VERSIONS=("3.7.0"
"3.8.2"
"3.9.1"
"3.10.4"
)
PY_INSTS=("python-3.6.2-macosx10.6.pkg"
"python-3.7.0-macosx10.6.pkg"
PY_INSTS=("python-3.7.0-macosx10.6.pkg"
"python-3.8.2-macosx10.9.pkg"
"python-3.9.1-macosx10.9.pkg"
"python-3.10.4-macos11.pkg"
)
PY_MMS=("3.6"
"3.7"
PY_MMS=("3.7"
"3.8"
"3.9"
"3.10"
)

NUMPY_VERSIONS=("1.14.5"
"1.14.5"
"1.14.5"
"1.19.3"
"1.22.0"
Expand Down
8 changes: 3 additions & 5 deletions python/build-wheel-manylinux2014.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ EOF
chmod +x /usr/bin/nproc

NODE_VERSION="14"
PYTHONS=("cp36-cp36m"
"cp37-cp37m"
PYTHONS=("cp37-cp37m"
"cp38-cp38"
"cp39-cp39"
"cp310-cp310"
"cp311-cp311")

NUMPY_VERSIONS=("1.14.5"
"1.14.5"
"1.14.5"
"1.19.3"
"1.22.0"
Expand Down Expand Up @@ -71,8 +69,8 @@ pushd python/ray/dashboard/client
popd
set -x

# Add the repo folder to the safe.dictory global variable to avoid the failure
# because of secruity check from git, when executing the following command
# Add the repo folder to the safe.dictory global variable to avoid the failure
# because of secruity check from git, when executing the following command
# `git clean ...`, while building wheel locally.
git config --global --add safe.directory /ray

Expand Down
22 changes: 8 additions & 14 deletions python/ray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,14 @@ def __getattr__(self, attr):
"PlacementGroupID",
]

if sys.version_info < (3, 7):
# TODO(Clark): Remove this one we drop Python 3.6 support.
# Lazy import is not supported in Python 3.6.
from ray import data # noqa: F401
from ray import workflow # noqa: F401
from ray import autoscaler # noqa: E402,F401
else:
# Delay importing of expensive, isolated subpackages.
def __getattr__(name: str):
import importlib

if name in ["data", "workflow", "autoscaler"]:
return importlib.import_module("." + name, __name__)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

# Delay importing of expensive, isolated subpackages.
def __getattr__(name: str):
import importlib

if name in ["data", "workflow", "autoscaler"]:
return importlib.import_module("." + name, __name__)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


del os
Expand Down
2 changes: 0 additions & 2 deletions python/ray/_private/async_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def __init__(self, func, args, kwds):
self._agen = func(*args, **kwds).__aiter__()

async def __aenter__(self):
if sys.version_info < (3, 5, 2):
self._agen = await self._agen
try:
return await self._agen.asend(None)
except StopAsyncIteration:
Expand Down
2 changes: 1 addition & 1 deletion python/ray/_private/ray_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def gcs_actor_scheduling_enabled():
# Supported Python versions for runtime env's "conda" field. Ray downloads
# Ray wheels into the conda environment, so the Ray wheels for these Python
# versions must be available online.
RUNTIME_ENV_CONDA_PY_VERSIONS = [(3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11)]
RUNTIME_ENV_CONDA_PY_VERSIONS = [(3, 7), (3, 8), (3, 9), (3, 10), (3, 11)]

# Whether to enable Ray clusters (in addition to local Ray).
# Ray clusters are not explicitly supported for Windows and OSX.
Expand Down
12 changes: 4 additions & 8 deletions python/ray/_private/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,7 @@ def decode(byte_str: str, allow_none: bool = False, encode_type: str = "utf-8"):

if not isinstance(byte_str, bytes):
raise ValueError(f"The argument {byte_str} must be a bytes object.")
if sys.version_info >= (3, 0):
return byte_str.decode(encode_type)
else:
return byte_str
return byte_str.decode(encode_type)


def ensure_str(s, encoding="utf-8", errors="strict"):
Expand All @@ -281,8 +278,7 @@ def binary_to_task_id(binary_task_id):

def binary_to_hex(identifier):
hex_identifier = binascii.hexlify(identifier)
if sys.version_info >= (3, 0):
hex_identifier = hex_identifier.decode()
hex_identifier = hex_identifier.decode()
return hex_identifier


Expand Down Expand Up @@ -1248,7 +1244,7 @@ def get_wheel_filename(
assert py_version in ray_constants.RUNTIME_ENV_CONDA_PY_VERSIONS, py_version

py_version_str = "".join(map(str, py_version))
if py_version_str in ["36", "37", "38", "39"]:
if py_version_str in ["37", "38", "39"]:
darwin_os_string = "macosx_10_15_x86_64"
else:
darwin_os_string = "macosx_10_15_universal2"
Expand All @@ -1270,7 +1266,7 @@ def get_wheel_filename(

wheel_filename = (
f"ray-{ray_version}-cp{py_version_str}-"
f"cp{py_version_str}{'m' if py_version_str in ['36', '37'] else ''}"
f"cp{py_version_str}{'m' if py_version_str in ['37'] else ''}"
f"-{os_strings[sys_platform]}.whl"
)

Expand Down
8 changes: 1 addition & 7 deletions python/ray/_private/workers/default_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import base64
import json
import time
import sys

import ray
import ray._private.node
Expand Down Expand Up @@ -171,12 +170,7 @@
args = parser.parse_args()
ray._private.ray_logging.setup_logger(args.logging_level, args.logging_format)

if sys.version_info >= (3, 7):
worker_launched_time_ms = time.time_ns() // 1e6
else:
# This value might be inaccurate in Python 3.6.
# We will anyway deprecate Python 3.6.
worker_launched_time_ms = time.time() * 1000
worker_launched_time_ms = time.time_ns() // 1e6

if args.worker_type == "WORKER":
mode = ray.WORKER_MODE
Expand Down
2 changes: 1 addition & 1 deletion python/ray/autoscaler/aws/example-gpu-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ file_mounts: {
# List of shell commands to run to set up nodes.
# NOTE: rayproject/ray:latest has ray latest bundled
setup_commands: []
# - pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp36-cp36m-manylinux2014_x86_64.whl
# - pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp37-cp37m-manylinux2014_x86_64.whl
# - pip install -U "ray[default] @ https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp37-cp37m-manylinux2014_x86_64.whl"

# Custom commands that will be run on the head node after common setup.
Expand Down
2 changes: 1 addition & 1 deletion python/ray/autoscaler/aws/example-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ initialization_commands:
setup_commands:
- sudo apt-get install -y python3 python3-pip
- python3 -m pip install --upgrade pip
- python3 -m pip install https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-0.9.0.dev0-cp36-cp36m-manylinux2014_x86_64.whl
- python3 -m pip install https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-0.9.0.dev0-cp37-cp37m-manylinux2014_x86_64.whl
# Custom commands that will be run on the head node after common setup.
head_setup_commands:
- python3 -m pip install boto3==1.4.8 # 1.4.8 adds InstanceMarketOptions
Expand Down
Loading