@@ -539,42 +539,51 @@ conda activate torch_rl
539
539
Depending on the use of functorch that you want to make, you may want to
540
540
install the latest (nightly) PyTorch release or the latest stable version of PyTorch.
541
541
See [ here] ( https://pytorch.org/get-started/locally/ ) for a detailed list of commands,
542
- including ` pip3 ` or windows/OSX compatible installation commands .
542
+ including ` pip3 ` or other special installation instructions .
543
543
544
544
** Torchrl**
545
545
546
546
You can install the ** latest stable release** by using
547
547
```
548
548
pip3 install torchrl
549
549
```
550
- This should work on linux and MacOs (not M1). For Windows and M1/M2 machines, one
551
- should install the library locally (see below).
550
+ This should work on linux, Windows 10 and OsX (Intel or Silicon chips).
551
+ On certain Windows machines (Windows 11), one should install the library locally (see below).
552
552
553
553
The ** nightly build** can be installed via
554
554
```
555
555
pip install torchrl-nightly
556
556
```
557
+ which we currently only ship for Linux and OsX (Intel) machines.
558
+ Importantly, the nightly builds require the nightly builds of PyTorch too.
557
559
558
560
To install extra dependencies, call
559
561
```
560
- pip3 install "torchrl[atari,dm_control,gym_continuous,rendering,tests,utils]"
562
+ pip3 install "torchrl[atari,dm_control,gym_continuous,rendering,tests,utils,marl,checkpointing ]"
561
563
```
562
564
or a subset of these.
563
565
564
- Alternatively, as the library is at an early stage, it may be wise to install
565
- it in develop mode as this will make it possible to pull the latest changes and
566
- benefit from them immediately.
567
- Start by cloning the repo:
566
+ One may also desire to install the library locally. Three main reasons can motivate this:
567
+ - the nightly/stable release isn't available for one's platform (eg, Windows 11, nightlies for Apple Silicon etc.);
568
+ - contributing to the code;
569
+ - install torchrl with a previous version of PyTorch (note that this should also be doable via a regular install followed
570
+ by a downgrade to a previous pytorch version -- but the C++ binaries will not be available.)
571
+
572
+ To install the library locally, start by cloning the repo:
568
573
```
569
574
git clone https://github.com/pytorch/rl
570
575
```
571
576
572
- Go to the directory where you have cloned the torchrl repo and install it
577
+ Go to the directory where you have cloned the torchrl repo and install it (after
578
+ installing ` ninja ` )
573
579
```
574
580
cd /path/to/torchrl/
575
- pip install -e .
581
+ pip install ninja -U
582
+ python setup.py develop
576
583
```
577
584
585
+ (unfortunately, ` pip install -e . ` will not work).
586
+
578
587
On M1 machines, this should work out-of-the-box with the nightly build of PyTorch.
579
588
If the generation of this artifact in MacOs M1 doesn't work correctly or in the execution the message
580
589
` (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) ` appears, then try
@@ -619,36 +628,44 @@ pip3 install wandb
619
628
620
629
** Troubleshooting**
621
630
622
- If a ` ModuleNotFoundError: No module named ‘torchrl._torchrl ` errors occurs,
631
+ If a ` ModuleNotFoundError: No module named ‘torchrl._torchrl ` errors occurs (or
632
+ a warning indicating that the C++ binaries could not be loaded),
623
633
it means that the C++ extensions were not installed or not found.
624
- One common reason might be that you are trying to import torchrl from within the
625
- git repo location. Indeed the following code snippet should return an error if
626
- torchrl has not been installed in ` develop ` mode:
627
- ```
628
- cd ~/path/to/rl/repo
629
- python -c 'from torchrl.envs.libs.gym import GymEnv'
630
- ```
631
- If this is the case, consider executing torchrl from another location.
632
-
633
- On ** MacOs** , we recommend installing XCode first.
634
- With Apple Silicon M1 chips, make sure you are using the arm64-built python
635
- (e.g. [ here] ( https://betterprogramming.pub/how-to-install-pytorch-on-apple-m1-series-512b3ad9bc6 ) ). Running the following lines of code
636
-
637
- ```
638
- wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
639
- python collect_env.py
640
- ```
641
- should display
642
- ```
643
- OS: macOS *** (arm64)
644
- ```
645
- and not
646
- ```
647
- OS: macOS **** (x86_64)
648
- ```
649
634
650
- Versioning issues can cause error message of the type ``` undefined symbol ``` and such. For these, refer to the [ versioning issues document] ( knowledge_base/VERSIONING_ISSUES.md ) for a complete explanation and proposed workarounds.
635
+ - One common reason might be that you are trying to import torchrl from within the
636
+ git repo location. The following code snippet should return an error if
637
+ torchrl has not been installed in ` develop ` mode:
638
+ ```
639
+ cd ~/path/to/rl/repo
640
+ python -c 'from torchrl.envs.libs.gym import GymEnv'
641
+ ```
642
+ If this is the case, consider executing torchrl from another location.
643
+ - If you're not importing torchrl from within its repo location, it could be
644
+ caused by a problem during the local installation. Check the log after the
645
+ ` python setup.py develop ` . One common cause is a g++/C++ version discrepancy
646
+ and/or a problem with the ` ninja ` library.
647
+ - If the problem persists, feel free to open an issue on the topic in the repo,
648
+ we'll make our best to help!
649
+ - On ** MacOs** , we recommend installing XCode first.
650
+ With Apple Silicon M1 chips, make sure you are using the arm64-built python
651
+ (e.g. [ here] ( https://betterprogramming.pub/how-to-install-pytorch-on-apple-m1-series-512b3ad9bc6 ) ).
652
+ Running the following lines of code
653
+ ```
654
+ wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
655
+ python collect_env.py
656
+ ```
657
+ should display
658
+ ```
659
+ OS: macOS *** (arm64)
660
+ ```
661
+ and not
662
+ ```
663
+ OS: macOS **** (x86_64)
664
+ ```
651
665
666
+ Versioning issues can cause error message of the type ``` undefined symbol ```
667
+ and such. For these, refer to the [ versioning issues document] ( knowledge_base/VERSIONING_ISSUES.md )
668
+ for a complete explanation and proposed workarounds.
652
669
653
670
## Asking a question
654
671
0 commit comments