diff --git a/ci/travis/check_import_order.py b/ci/travis/check_import_order.py index bf349ca89..26536fbfd 100644 --- a/ci/travis/check_import_order.py +++ b/ci/travis/check_import_order.py @@ -1,6 +1,6 @@ """ This script ensures python files conform to ray's import ordering rules. -In particular, we make sure psutil and setproctitle is imported _after_ +In particular, we make sure psutil is imported _after_ importing ray due to our bundling of the two libraries. Usage: @@ -22,7 +22,6 @@ def check_import(file): check_to_lines = { "import ray": -1, "import psutil": -1, - "import setproctitle": -1 } with io.open(file, "r", encoding="utf-8") as f: @@ -41,7 +40,7 @@ def check_import(file): line) and check_to_lines[check] == -1: check_to_lines[check] = i - for import_lib in ["import psutil", "import setproctitle"]: + for import_lib in ["import psutil"]: if check_to_lines[import_lib] != -1: import_psutil_line = check_to_lines[import_lib] import_ray_line = check_to_lines["import ray"] diff --git a/ci/travis/format.sh b/ci/travis/format.sh index 7a6b45751..bd0f04a0a 100755 --- a/ci/travis/format.sh +++ b/ci/travis/format.sh @@ -291,7 +291,7 @@ else fi # Ensure import ordering -# Make sure that for every import psutil; import setproctitle +# Make sure that for every import psutil # There's a import ray above it. PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE:-python} diff --git a/ci/travis/install-dependencies.sh b/ci/travis/install-dependencies.sh index 5d39c1c8b..4d5b67e2b 100755 --- a/ci/travis/install-dependencies.sh +++ b/ci/travis/install-dependencies.sh @@ -333,7 +333,7 @@ install_dependencies() { install_node fi - CC=gcc pip install psutil setproctitle --target="${WORKSPACE_DIR}/python/ray/thirdparty_files" + CC=gcc pip install psutil --target="${WORKSPACE_DIR}/python/ray/thirdparty_files" } install_dependencies "$@" diff --git a/doc/source/installation.rst b/doc/source/installation.rst index 151a4dbc4..890db304e 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -340,32 +340,3 @@ that you've cloned the git repository. .. code-block:: bash python -m pytest -v python/ray/tests/test_mini.py - -Troubleshooting ---------------- - -If importing Ray (``python3 -c "import ray"``) in your development clone results -in this error: - -.. code-block:: python - - Traceback (most recent call last): - File "", line 1, in - File ".../ray/python/ray/__init__.py", line 63, in - import ray._raylet # noqa: E402 - File "python/ray/_raylet.pyx", line 98, in init ray._raylet - import ray.memory_monitor as memory_monitor - File ".../ray/python/ray/memory_monitor.py", line 9, in - import psutil # noqa E402 - File ".../ray/python/ray/thirdparty_files/psutil/__init__.py", line 159, in - from . import _psosx as _psplatform - File ".../ray/python/ray/thirdparty_files/psutil/_psosx.py", line 15, in - from . import _psutil_osx as cext - ImportError: cannot import name '_psutil_osx' from partially initialized module 'psutil' (most likely due to a circular import) (.../ray/python/ray/thirdparty_files/psutil/__init__.py) - -Then you should run the following commands: - -.. code-block:: bash - - rm -rf python/ray/thirdparty_files/ - python3 -m pip install setproctitle diff --git a/python/ray/__init__.py b/python/ray/__init__.py index 848ea5910..e1f4af708 100644 --- a/python/ray/__init__.py +++ b/python/ray/__init__.py @@ -37,7 +37,7 @@ pickle5_path = os.path.join( os.path.abspath(os.path.dirname(__file__)), "pickle5_files") sys.path.insert(0, pickle5_path) -# Importing psutil & setproctitle. Must be before ray._raylet is initialized. +# Importing psutil. Must be before ray._raylet is initialized. thirdparty_files = os.path.join( os.path.abspath(os.path.dirname(__file__)), "thirdparty_files") sys.path.insert(0, thirdparty_files) diff --git a/python/ray/tests/test_actor.py b/python/ray/tests/test_actor.py index 05d53c1b3..3824463e1 100644 --- a/python/ray/tests/test_actor.py +++ b/python/ray/tests/test_actor.py @@ -10,15 +10,12 @@ except ImportError: import sys import tempfile import datetime +import setproctitle import ray import ray.test_utils import ray.cluster_utils -# NOTE: We have to import setproctitle after ray because we bundle setproctitle -# with ray. -import setproctitle - def test_caching_actors(shutdown_only): # Test defining actors before ray.init() has been called. diff --git a/python/ray/tests/test_advanced_3.py b/python/ray/tests/test_advanced_3.py index 7f1e8e639..3d6334e1f 100644 --- a/python/ray/tests/test_advanced_3.py +++ b/python/ray/tests/test_advanced_3.py @@ -10,6 +10,7 @@ import time import numpy as np import pickle import pytest +import setproctitle import ray import ray.ray_constants as ray_constants @@ -17,7 +18,6 @@ import ray.util.accelerators import ray.cluster_utils import ray.test_utils from ray import resource_spec -import setproctitle import subprocess from ray.test_utils import (check_call_ray, RayTestTimeoutException, diff --git a/python/requirements.txt b/python/requirements.txt index 28c387fde..426cd5b89 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -23,6 +23,7 @@ py-spy >= 0.2.0 pyyaml redis >= 3.5.0 requests +setproctitle ## setup.py extras atari_py diff --git a/python/setup.py b/python/setup.py index 3687903b9..03047d73b 100644 --- a/python/setup.py +++ b/python/setup.py @@ -143,6 +143,7 @@ install_requires = [ "py-spy >= 0.2.0", "pyyaml", "requests", + "setproctitle", "redis >= 3.5.0", "opencensus", "prometheus_client >= 0.7.1", @@ -270,7 +271,7 @@ def build(build_python, build_java): # that certain flags will not be passed along such as --user or sudo. # TODO(rkn): Fix this. if not os.getenv("SKIP_THIRDPARTY_INSTALL"): - pip_packages = ["psutil", "setproctitle"] + pip_packages = ["psutil"] subprocess.check_call( [ sys.executable, "-m", "pip", "install", "-q",