RLlib installation help

Installation help - Update

(thanks to @Yard1)

You might run into importing errors with the approach above (especially when turning from developing for rllib to tune or other parts of ray). Errors like:

Traceback (most recent call last):
  File "/home/simon/git-projects/ray/python/ray/setup-dev.py", line 12, in <module>
    import ray
  File "/home/simon/git-projects/ray/.venv/lib/python3.9/site-packages/ray/__init__.py", line 91, in <module>
    import ray._raylet  # noqa: E402
  File "python/ray/_raylet.pyx", line 127, in init ray._raylet
    from ray import external_storage
  File "/home/simon/git-projects/ray/.venv/lib/python3.9/site-packages/ray/util/__init__.py", line 4, in <module>
    from ray._private.services import get_node_ip_address
  File "/home/simon/git-projects/ray/.venv/lib/python3.9/site-packages/ray/_private/services.py", line 25, in <module>
    from ray._private.gcs_utils import GcsClient
  File "/home/simon/git-projects/ray/.venv/lib/python3.9/site-packages/ray/_private/gcs_utils.py", line 78, in <module>
    *ray_constants.GLOBAL_GRPC_OPTIONS,
AttributeError: module 'ray.ray_constants' has no attribute 'GLOBAL_GRPC_OPTIONS'

In this case the following procedure might help you to setup a working environment:

Preparations

Install (upgrade) the core-plugins:

sudo dnf install dnf-plugins-core -y

Install (upgrade) the dependencies:

sudo dnf install gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make -y

Fork and clone the ray repo

Follow the documentation on GitHub. Then navigate into the cloned repo.

Create a virtual environment

Inside of the ray folder type:

python -m venv .venv

Activate it:

source .venv/bin/activate

And upgrade pip:

python -m pip install --upgrade pip

Ray intallation

Install the nightly wheel corresponding to your Python version:

# Example: Linux system with Python 3.9.0
python -m pip install -U --no-cache-dir https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-2.0.0.dev0-cp39-cp39-manylinux2014_x86_64.whl

Requirements

Note that the nightly wheel will already install all requirements (so no need to install python/requirements.txt). The linter requirements however are not yet installed and should be added:

python -m pip install -U --no-cache-dir -r python/requirements_linters.txt

Adding further requirements

Most modules in ray have their own requirements and they can be added by installing them from the release:

# Example: Adding additional requirements for rllib, tune, and ml
python -m pip install -U --no-cache-dir "ray[rllib,tune,ml]"

Then add any further requirements you need for testing, like for example some gym environment modules.

Testing installation

Run the linting by calling

scripts/format.sh

Bring repo up-to-date

Pull the newest changes:

git pull upstream master

NOTE: This git command should suffice when adding the newest changes to your local repo. There can be some differences that have to be taken care of (when you changed a file and some other contributor did). The usually git fetch upstream; git pull --rebase upstream master; git pull can and should be neglected here.

Create branch

Create a new branch and switch to it:

git checkout -b mynew-branch

Note: Then always when you pulled the master from upstream merge it in the branch with git merge master

Inside the branch run the development setup to link the repo files (as you will change some in the branch) with the ray installation (so you can run your changes and test them):

python python/setup-dev.py -y

From hereon these import error from above should vanish and everything should run fine.

Note: When running the RLlib tests you should also make sure to have installed the Atari environments via:

python -m pip install "gym[atari]" "gym[accept-rom-license]" atari_py

I also wrote a shell script that does all that at once, so I do not have to repeat everything by hand.

How to get support?

Reply in this thread, if you have installation problems.

2 Likes