[BUG] Unable to install torchrl via pip
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
pipand ``git+https` - Python 3.12
Tensordict 0.4.0+b4c91e8(installed viapip install git+https://github.com/pytorch-labs/tensordict, becausepip install tensordictinstalls versiontensordict-0.1.2buttorchrlrequirestensordict>=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)
We don't support 3.12 atm but that will be the case for the next major release I think!
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?
I am also curious if there are any (approximate) plans for a new major (or even minor) release?
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)
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'
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!
Sure no worry. I just wanted to ensure that you knew it was still broken.
Best of luck with that :)
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 :)
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
No worries. One more reason to update my old laptop ;)