Skip to content

[BUG] Cannot import torchrl on M2 MacBook Pro when install from Git repo. #1582

Closed
@EkaterinaAbramova

Description

Describe the bug

Cannot import torchrl on M2 MacBook Pro when install from Git repo.

To Reproduce

I have installed torchrl from GitHub following the online instructions from your repo:

git clone https://github.com/pytorch/rl
cd /path/to/torchrl/
pip install -e .

Issue 1 [suggested resolution]: the path setup worked for rl/ folder not torchrl/ as the setup.py is inside rl not torchrl. So that instruction should updated in your docs please.
Issue 2 [unresolved]: it says this should work straight out of the box on M1. I have the M2 and when I import torch it is ok, but when I import torchrl I get the following error: ImportError: cannot import name 'unravel_key' from 'tensordict' (/Users/myname/anaconda3/envs/gpu-torch-rl/lib/python3.10/site-packages/tensordict/__init__.py)

Expected behavior

I expect to be able to import the torchrl library.

Screenshots

Screenshot 2023-09-29 at 12 14 33

System info

Apple M2 max
Version 13.5.2

Describe the characteristic of your environment:

Steps Ive taken up until the error:

conda create --name gpu-torch-rl python=3.10 spyder=5.4.3
conda activate gpu-torch-rl

git clone https://github.com/pytorch/rl /Users/myname/anaconda3/repos/rl

cd /Users/myname/anaconda3/repos/rl/
pip install -e .

Additional context

I also tried to get the tensordict from GitHub to resolve this unravel key issue, and tried:

pip uninstall tensordict
pip install git+https://github.com/pytorch-labs/tensordict

which resolved this issue, however I had a bunch of other issues after that, so am keen to understand why the tensordict that came together with the torchrl download didn't work. Surely it should be compatible. Could you please resolve this issue?

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions