RLlib installation help

After having tackled some installation difficulties on my Linux Fedora 35 with @avnishn and @sven1977, we decided to put the results here in form of a longer support thread to give users who want to contribute some guidance.

There are some steps that are needed in addition to a simple installation as metioned here and here.

Linux Fedora 35 - Install Ray

Thanks to Avnish and Sven!

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

Create a virtual environment

python -m venv .venv

Activate it:

source ./venv/bin/activate

And upgrade pip:

python -m pip install --upgrade pip

Fork and clone the ray repo

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

Ray installation

Install the last release:

python -m pip install -U --no-cache-dir ray

Remove the bazel directory from the repo

rm -rf bazel

Setup development links

Execute

python python/ray/setup-dev.py

IMPORTANT: And after saying yes to rllib exit by CTRL+C.

Requirements

Here it becomes usually tricky and the way I found is to use the latest wheel for the following four packages:

scikit-learn
tensorflow
llvm-lite
scipy

Use vim to directly erase the version specifications. Then install the requirements:

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

Testing installation

Run the linting by calling

./ci/travis/format.sh

Bring repo up-to-date

First repair the python/requirements.txt:

git checkout master -- python/requirements.txt

Then 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.

How to get support?

Reply in this thread, if you have installation problem

2 Likes

Thanks @Lars_Simon_Zehnder that is very helpful!

2 Likes

@Ray-Team The script ./ci/travis/format.sh is not anymore there, where has it gone in the repo?

the ./scripts/format.sh symlink still exists, otherwise it’s ./ci/lint/format.sh

1 Like

@Lars_Simon_Zehnder I believe you also need to do a ray install-nightly step after pip install ray, otherwise you’ll run into mismatches between the symlinked packages and the non-symlinked ones.

@amogkam I get an error when executing ray install-nightly:

Error: Unable to identify a matching platform. Please visit https://docs.ray.io/en/master/installation.html to obtain the latest wheels.

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