Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to install torchrl via pip #2035

Closed
laurenzlevi opened this issue Mar 21, 2024 · 11 comments · Fixed by #2282
Closed

[BUG] Unable to install torchrl via pip #2035

laurenzlevi opened this issue Mar 21, 2024 · 11 comments · Fixed by #2282
Assignees
Labels
bug Something isn't working

Comments

@laurenzlevi
Copy link

Describe the bug

Unable to install torchrl via pip for python312.

>>> pip install torchrl
ERROR: Could not find a version that satisfies the requirement torchrl (from versions: none)
ERROR: No matching distribution found for torchrl

To Reproduce

Fresh install of python 3.12, running pip install torchrl triggers the error mentioned above.

Installing via pip install git+https://github.com/pytorch/rl.git gives the error message

ERROR: Could not find a version that satisfies the requirement tensordict>=0.4.0 (from torchrl) (from versions: 0.0.1a0, 0.0.1b0, 0.0.1rc0, 0.0.2a0, 0.0.2b0, 0.0.3, 0.1.0, 0.1.1, 0.1.2)
ERROR: No matching distribution found for tensordict>=0.4.0

Installing tensordict via pip install git+https://github.com/pytorch-labs/tensordict works and allows for a subsequent installation of torchrl via pip install git+https://github.com/pytorch/rl.git, but using the module leads to the following error

Traceback (most recent call last):
  File "C:\Projects\repos\Rainbow-DQN\test.py", line 1, in <module>
    from torchrl.modules.models import NoisyLazyLinear
  File "C:\Users\pixel\AppData\Local\Programs\Python\Python312\Lib\site-packages\torchrl\__init__.py", line 10, in <module>
    from tensordict import set_lazy_legacy
  File "C:\Users\pixel\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensordict\__init__.py", line 6, in <module>
    from tensordict._lazy import LazyStackedTensorDict
  File "C:\Users\pixel\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensordict\_lazy.py", line 24, in <module>
    from functorch import dim as ftdim
  File "C:\Users\pixel\AppData\Local\Programs\Python\Python312\Lib\site-packages\functorch\dim\__init__.py", line 7, in <module>
    import functorch._C
ImportError: initialization failed

Expected behavior

torchrl should install.

System info

Describe the characteristic of your environment:

  • Library was installed via pip and ``git+https`
  • Python 3.12
  • Tensordict 0.4.0+b4c91e8 (installed via pip install git+https://github.com/pytorch-labs/tensordict, because pip install tensordict installs version tensordict-0.1.2 but torchrl requires tensordict>=0.4.0)
  • torch 2.2.1+cu121 (works flawlessly)

System information:

  • sys.__version: 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)]
  • Platform: Windows 10 Home 10.0.19045 Build 19045
  • Cuda: release 12.3, V12.3.103

Checklist

  • [ x] I have checked that there is no similar issue in the repo (required)
  • [ x] I have read the documentation (required)
  • [ x] I have provided a minimal working example to reproduce the bug (required)
@laurenzlevi laurenzlevi added the bug Something isn't working label Mar 21, 2024
@vmoens
Copy link
Contributor

vmoens commented Mar 28, 2024

We don't support 3.12 atm but that will be the case for the next major release I think!

@laurenzlevi
Copy link
Author

Ah okay I´ll be using 3.11 then for now, is there any approximate release window for the next major version and should I close the issue or leave it open for others to see?

@wbinventor
Copy link

I am also curious if there are any (approximate) plans for a new major (or even minor) release?

@vmoens
Copy link
Contributor

vmoens commented Apr 23, 2024

I'm behind schedule for the 0.3.2 minor because the CI was giving me some issues and I couldn't guarantee that the wheels were working fine. I will try to release it shortly!

0.4 will be there soon (PyTorch release day is tomorrow, expect the v0.4 release in the days after)

@GaetanLepage
Copy link
Contributor

For me, tensordict 0.4.0 is still broken for python 3.12 as it relies on the now deprecated distutils package:

RuntimeError: First class dim doesn't work with python 3.12

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/nix/store/v9avkh4lq80zm23sjrr5jfk0f06xhgpx-python3.12-tensordict-0.4.0/lib/python3.12/site-packages/tensordict/_lazy.py", line 26, in <module>
    from functorch import dim as ftdim
  File "/nix/store/pn0xqrvfqf7cri031497b7y3nprfjyx7-python3.12-torch-2.2.2/lib/python3.12/site-packages/functorch/dim/__init__.py", line 7, in <module>
    import functorch._C
ImportError: initialization failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "/nix/store/aav6i2sih47qjwz0shpl4mmpp877v16k-python3-3.12.3/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/nix/store/v9avkh4lq80zm23sjrr5jfk0f06xhgpx-python3.12-tensordict-0.4.0/lib/python3.12/site-packages/tensordict/__init__.py", line 6, in <module>
    from tensordict._lazy import LazyStackedTensorDict
  File "/nix/store/v9avkh4lq80zm23sjrr5jfk0f06xhgpx-python3.12-tensordict-0.4.0/lib/python3.12/site-packages/tensordict/_lazy.py", line 30, in <module>
    from tensordict.utils import _ftdim_mock as ftdim
  File "/nix/store/v9avkh4lq80zm23sjrr5jfk0f06xhgpx-python3.12-tensordict-0.4.0/lib/python3.12/site-packages/tensordict/utils.py", line 22, in <module>
    from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils'

@vmoens
Copy link
Contributor

vmoens commented May 7, 2024

Same 3.12 issue I'm afraid!
I will work on making a release for 3.12 for 0.4.1, but no promises!
Please bear with me on this one!

@GaetanLepage
Copy link
Contributor

Sure no worry. I just wanted to ensure that you knew it was still broken.

Best of luck with that :)

@chnyutao
Copy link

chnyutao commented May 9, 2024

Related issue here. I see that since v0.4.0 all macOS x86 builds are removed and I have to build wheels from source. May I ask why macOS x86 is no longer supported? Thanks :)

@vmoens
Copy link
Contributor

vmoens commented May 9, 2024

This saddens me too very much, but the latest pytorch release (2.3) doesn't support x86 anymore so there was no way for us to release v0.4 for these platforms :(
https://github.com/pytorch/pytorch/releases/tag/v2.2.0
So sorry about that! This one's way beyond my control

@chnyutao
Copy link

chnyutao commented May 9, 2024

No worries. One more reason to update my old laptop ;)

@carschandler
Copy link
Contributor

carschandler commented Nov 6, 2024

Hey there, I wanted to chime back in on this issue because I'm failing to import with the same distutils error message on Python 3.12 / torchrl 0.6.0 on linux_x86-64.

EDIT: after digging into this a bit more, it seems that somehow my environment (using pixi as my package manager) had gotten borked and a pixi clean followed by pixi install was enough to get import distutils working again (provided through setuptools)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants