# RLlib installation help

**URL:** <https://discuss.ray.io/t/rllib-installation-help/5577>\
**Category:** RLlib\
**Created:** [March 28, 2022, 9:51pm UTC](https://discuss.ray.io/t/rllib-installation-help/5577 "2022-03-28T21:51:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars\_Simon\_Zehnder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lars_simon_zehnder/32/1185_2.png) [@Lars\_Simon\_Zehnder](https://discuss.ray.io/u/Lars_Simon_Zehnder)\
**Post date:** [March 28, 2022, 9:51pm UTC](https://discuss.ray.io/t/rllib-installation-help/5577/1 "2022-03-28T21:51:31Z")

</div>

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](https://docs.ray.io/en/latest/ray-contribute/getting-involved.html) and [here](https://docs.ray.io/en/latest/rllib/rllib-dev.html).

# Linux Fedora 35 - Install Ray

Thanks to _Avnish_ and _Sven_!

## Preparations

### Install (upgrade) the core-plugins:

```auto
sudo dnf install dnf-plugins-core -y

```

### Install (upgrade) the dependencies:

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

```

# Create a virtual environment

```auto
python -m venv .venv

```

Activate it:

```auto
source ./venv/bin/activate

```

And upgrade `pip`:

```auto
python -m pip install --upgrade pip

```

### Fork and clone the ray repo

Follow the documentation on [GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo). **Then navigate into the cloned repo.**

## Ray installation

Install the last release:

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

```

### Remove the bazel directory from the repo

```auto
rm -rf bazel

```

### Setup development links

Execute

```auto
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:

```auto
scikit-learn
tensorflow
llvm-lite
scipy

```

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

```auto
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

```auto
./ci/travis/format.sh

```

## Bring repo up-to-date

First repair the `python/requirements.txt`:

```auto
git checkout master -- python/requirements.txt

```

Then pull the newest changes:

```auto
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

---

<div class="post-metadata">

**Author:** ![kai](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/kai/32/3380_2.png) [@kai](https://discuss.ray.io/u/kai)\
**Post date:** [March 29, 2022, 2:46pm UTC](https://discuss.ray.io/t/rllib-installation-help/5577/2 "2022-03-29T14:46:35Z")

</div>

Thanks @Lars_Simon_Zehnder that is very helpful!

---

<div class="post-metadata">

**Author:** ![Lars\_Simon\_Zehnder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lars_simon_zehnder/32/1185_2.png) [@Lars\_Simon\_Zehnder](https://discuss.ray.io/u/Lars_Simon_Zehnder)\
**Post date:** [May 13, 2022, 9:55am UTC](https://discuss.ray.io/t/rllib-installation-help/5577/3 "2022-05-13T09:55:22Z")

</div>

[@Ray-Team](https://discuss.ray.io/groups/ray-team) The script `./ci/travis/format.sh` is not anymore there, where has it gone in the repo?

---

<div class="post-metadata">

**Author:** ![kai](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/kai/32/3380_2.png) [@kai](https://discuss.ray.io/u/kai)\
**Post date:** [May 13, 2022, 10:20am UTC](https://discuss.ray.io/t/rllib-installation-help/5577/4 "2022-05-13T10:20:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amogkam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/amogkam/32/17_2.png) [@amogkam](https://discuss.ray.io/u/amogkam)\
**Post date:** [May 13, 2022, 4:29pm UTC](https://discuss.ray.io/t/rllib-installation-help/5577/5 "2022-05-13T16:29:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lars\_Simon\_Zehnder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lars_simon_zehnder/32/1185_2.png) [@Lars\_Simon\_Zehnder](https://discuss.ray.io/u/Lars_Simon_Zehnder)\
**Post date:** [May 14, 2022, 4:59pm UTC](https://discuss.ray.io/t/rllib-installation-help/5577/6 "2022-05-14T16:59:06Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![Lars\_Simon\_Zehnder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lars_simon_zehnder/32/1185_2.png) [@Lars\_Simon\_Zehnder](https://discuss.ray.io/u/Lars_Simon_Zehnder)\
**Post date:** [May 16, 2022, 7:39am UTC](https://discuss.ray.io/t/rllib-installation-help/5577/7 "2022-05-16T07:39:37Z")

</div>

# 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:

```auto
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:

```auto
sudo dnf install dnf-plugins-core -y

```

### Install (upgrade) the dependencies:

```auto
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](https://docs.github.com/en/get-started/quickstart/fork-a-repo). **Then navigate into the cloned repo.**

## Create a virtual environment

Inside of the `ray` folder type:

```auto
python -m venv .venv

```

Activate it:

```auto
source .venv/bin/activate

```

And upgrade pip:

```auto
python -m pip install --upgrade pip

```

## Ray intallation

Install the [nightly wheel](https://docs.ray.io/en/latest/ray-overview/installation.html#daily-releases-nightlies) corresponding to your Python version:

```auto
# 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:

```auto
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:

```auto
# 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

```auto
scripts/format.sh

```

## Bring repo up-to-date

Pull the newest changes:

```auto
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:

```auto
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):

```auto
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
python -m pip install "gym[atari]" "gym[accept-rom-license]" atari_py

```

I also wrote a [shell script](https://github.com/simonsays1980/ray-installation-help/blob/main/virtual_env_install.sh) 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.
