diff --git a/doc/source/installation.rst b/doc/source/installation.rst index 20d49edaea7d..f3ad649d683d 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -10,7 +10,7 @@ You can install the latest stable version of Ray as follows. .. code-block:: bash - pip install -U ray + pip install -U ray # also recommended: ray[debug] Trying snapshots from master ---------------------------- diff --git a/doc/source/rllib.rst b/doc/source/rllib.rst index 23c69506e008..2de444b52965 100644 --- a/doc/source/rllib.rst +++ b/doc/source/rllib.rst @@ -15,7 +15,7 @@ RLlib has extra dependencies on top of ``ray``. First, you'll need to install ei .. code-block:: bash pip install tensorflow # or tensorflow-gpu - pip install ray[rllib] + pip install ray[rllib] # also recommended: ray[debug] You might also want to clone the `Ray repo `__ for convenient access to RLlib helper scripts: diff --git a/doc/source/tune.rst b/doc/source/tune.rst index 87f28531bee8..14c95fb0edcb 100644 --- a/doc/source/tune.rst +++ b/doc/source/tune.rst @@ -45,7 +45,7 @@ You'll need to first `install ray `__ to import Tune. .. code-block:: bash - pip install ray + pip install ray # also recommended: ray[debug] Quick Start diff --git a/python/ray/memory_monitor.py b/python/ray/memory_monitor.py index 23d6c12b5f9c..00cf86816dbf 100644 --- a/python/ray/memory_monitor.py +++ b/python/ray/memory_monitor.py @@ -56,8 +56,9 @@ def __init__(self, error_threshold=0.95, check_interval=1): if not psutil: logger.warning( "WARNING: Not monitoring node memory since `psutil` is not " - "installed. Install this with `pip install psutil` to enable " - "debugging of memory-related crashes.") + "installed. Install this with `pip install psutil` " + "(or ray[debug]) to enable debugging of memory-related " + "crashes.") def raise_if_low_memory(self): if not psutil: diff --git a/python/ray/scripts/scripts.py b/python/ray/scripts/scripts.py index d78f2f9c1dd1..929ee3785906 100644 --- a/python/ray/scripts/scripts.py +++ b/python/ray/scripts/scripts.py @@ -651,7 +651,7 @@ def stack(): COMMAND = """ pyspy=`which py-spy` if [ ! -e "$pyspy" ]; then - echo "ERROR: Please 'pip install py-spy' first" + echo "ERROR: Please 'pip install py-spy' (or ray[debug]) first" exit 1 fi # Set IFS to iterate over lines instead of over words. diff --git a/python/ray/tune/trial_runner.py b/python/ray/tune/trial_runner.py index 98bbbcb71c64..d89b3dda7ee1 100644 --- a/python/ray/tune/trial_runner.py +++ b/python/ray/tune/trial_runner.py @@ -236,7 +236,8 @@ def _memory_debug_string(self): return "Memory usage on this node: {}/{} GB{}".format( round(used_gb, 1), round(total_gb, 1), warn) except ImportError: - return "Unknown memory usage (`pip install psutil` to resolve)" + return ("Unknown memory usage. Please run `pip install psutil` " + "(or ray[debug]) to resolve)") def has_resources(self, resources): """Returns whether this runner has at least the specified resources.""" diff --git a/python/ray/worker.py b/python/ray/worker.py index f68bb42886f0..c3c01f4859fc 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -12,7 +12,6 @@ import numpy as np import os import redis -import setproctitle import signal import sys import threading @@ -73,6 +72,15 @@ # using logging.basicConfig in its entry/init points. logger = logging.getLogger(__name__) +try: + import setproctitle +except ImportError: + setproctitle = None + logger.warning( + "WARNING: Not updating worker name since `setproctitle` is not " + "installed. Install this with `pip install setproctitle` " + "(or ray[debug]) to enable monitoring of worker processes.") + class RayTaskError(Exception): """An object used internally to represent a task that threw an exception. @@ -1916,7 +1924,8 @@ def connect(info, # Initialize some fields. if mode is WORKER_MODE: worker.worker_id = random_string() - setproctitle.setproctitle("ray_worker") + if setproctitle: + setproctitle.setproctitle("ray_worker") else: # This is the code path of driver mode. if driver_id is None: @@ -2163,9 +2172,11 @@ def disconnect(worker=global_worker): @contextmanager def _changeproctitle(title, next_title): - setproctitle.setproctitle(title) + if setproctitle: + setproctitle.setproctitle(title) yield - setproctitle.setproctitle(next_title) + if setproctitle: + setproctitle.setproctitle(next_title) def _try_to_compute_deterministic_class_id(cls, depth=5): diff --git a/python/setup.py b/python/setup.py index 7198de2329bf..c92ffa65b481 100644 --- a/python/setup.py +++ b/python/setup.py @@ -64,7 +64,10 @@ optional_ray_files += ray_autoscaler_files -extras = {"rllib": ["pyyaml", "gym[atari]", "opencv-python", "lz4", "scipy"]} +extras = { + "rllib": ["pyyaml", "gym[atari]", "opencv-python", "lz4", "scipy"], + "debug": ["psutil", "setproctitle", "py-spy"], +} class build_ext(_build_ext.build_ext): @@ -139,7 +142,6 @@ def find_version(*filepath): "pytest", "pyyaml", "redis", - "setproctitle", # The six module is required by pyarrow. "six >= 1.0.0", "flatbuffers",