Skip to content

Commit

Permalink
[Docs] add installation instructions with uv, poetry, conda
Browse files Browse the repository at this point in the history
  • Loading branch information
fedebotu committed Jan 14, 2025
1 parent 5d20509 commit 841c937
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 12 deletions.
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a href="https://pytorchlightning.ai/"><img alt="Lightning" src="https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white"></a>
<a href="https://github.com/pytorch/rl"><img alt="base: TorchRL" src="https://img.shields.io/badge/base-TorchRL-red"></a>
<a href="https://hydra.cc/"><img alt="config: Hydra" src="https://img.shields.io/badge/config-Hydra-89b8cd"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
<a href="https://join.slack.com/t/rl4co/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ"><img alt="Slack" src="https://img.shields.io/badge/slack-chat-611f69.svg?logo=slack"></a>
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-red.svg"></a>
<a href="https://colab.research.google.com/github/ai4co/rl4co/blob/main/examples/1-quickstart.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
Expand Down Expand Up @@ -89,7 +89,7 @@ git clone https://github.com/ai4co/rl4co && cd rl4co
pip install -e .
```

We recommend using a virtual environment such as `conda` to install `rl4co` locally.
We recommend installing in virtual environments with a package manager such as the blazing-fast [`uv`](https://docs.astral.sh/uv/), [`poetry`](https://python-poetry.org/), or [`conda`](https://docs.conda.io/en/latest/); instruction are available in the [documentation](https://rl4.co/docs/content/start/installation/).



Expand Down Expand Up @@ -174,14 +174,7 @@ pytest tests

### Known Bugs


#### Bugs installing PyTorch Geometric (PyG)

Installing `PyG` via `Conda` seems to update Torch itself. We have found that this update introduces some bugs with `torchrl`. At this moment, we recommend installing `PyG` with `Pip`:
```bash
pip install torch_geometric
```

You may check out the [issues](https://github.com/ai4co/rl4co/issues) and [discussions](https://github.com/ai4co/rl4co/discussions). We will also periodically post updates on the [FAQ section](https://rl4.co/docs/content/general/faq/).

## Contributing

Expand Down
56 changes: 54 additions & 2 deletions docs/content/start/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,66 @@ pip install rl4co
```

## Local install and development
If you want to develop RL4CO or access the latest builds, we recommend you to install it locally with `pip` in editable mode:
If you want to develop RL4CO or access the latest builds, you may install it locally after downloading the repo:

```bash
git clone https://github.com/ai4co/rl4co && cd rl4co
```

The simplest way is via `pip` in editable mode with
```bash
pip install -e .
```

> Note: `conda` is also a good candidate for hassle-free installation of PyTorch: check out the [PyTorch website](https://pytorch.org/get-started/locally/) for more details.
To install optional dependencies, you may specify them as follows `pip install -e ".[dev,graph,routing,docs]"`.

We recommend installing in virtual environments with a package manager such as the blazing-fast [`uv`](https://docs.astral.sh/uv/), [`poetry`](https://python-poetry.org/), or [`conda`](https://docs.conda.io/en/latest/), with quickstart commands below:

<details>
<summary>Install with `uv`</summary>

You first need to install `uv`, i.e., with `pip`:
```bash
pip install uv
```

Then, you can create a virtual environment locally and activate it:
```bash
uv sync --frozen
source .venv/bin/activate
```

Note that `uv` directly generates the `.venv` folder in the current directory.


</details>


<details>
<summary>Install with `poetry`</summary>

Make sure that you have `poetry` installed from the [official website](https://python-poetry.org/docs/).

Then, you can create a virtual environment locally:
```bash
poetry install
poetry env activate # poetry shell removed in poetry 2.0.0
```

Note: you need to upgrade `poetry` to the latest version with `poetry self update` to versions >=2.0.0 (see [blog post](https://python-poetry.org/blog/announcing-poetry-2.0.0/)). This is also the reason why we don't need a special `pyproject.toml` anymore.

</details>


<details>
<summary>Install with `conda`</summary>

After [installing `conda`](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html), you can create a virtual environment locally with:
```bash
conda create -n rl4co python=3.12
conda activate rl4co
```
</details>


## Minimalistic Example
Expand Down

0 comments on commit 841c937

Please sign in to comment.