Error in Reinforcement Learning example

I got the error below while following the tutorial in documentation.

When I run python train.py --task Cartpole or python rlg_train.py --task Cartpole, I receive the error below.

$ python train.py --task Cartpole
Importing module 'gym_37' (/home/donguk/Downloads/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_37.so)
Setting GYM_USD_PLUG_INFO_PATH to /home/donguk/Downloads/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
PyTorch version 1.9.0+cu111
Device count 1
/home/donguk/Downloads/isaacgym/python/isaacgym/_bindings/src/gymtorch
Using /home/donguk/.cache/torch_extensions as PyTorch extensions root...
Emitting ninja build file /home/donguk/.cache/torch_extensions/gymtorch/build.ninja...
Building extension module gymtorch...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module gymtorch...
Traceback (most recent call last):
  File "train.py", line 12, in <module>
    from utils.parse_task import parse_task
  File "/home/donguk/Downloads/isaacgym/python/rlgpu/utils/parse_task.py", line 17, in <module>
    from rlgpu.tasks.anymal import Anymal
  File "/home/donguk/Downloads/isaacgym/python/rlgpu/tasks/anymal.py", line 18, in <module>
    from torch.tensor import Tensor
ModuleNotFoundError: No module named 'torch.tensor'

It seems that torch version mismatch is the problem. though…
As you can see in the log, I have installed pytorch 1.90, which is required version for isaacgym.

Would you kindly help to handle this problem?

Hi @ehddnr7471

I use torch 1.8.1 to run Isaac Gym, and everything goes well

pip install torch==1.8.1
2 Likes

Another solution is to change the code in anymal.py.

--- from torch.tensor import Tensor
+++ Tensor = torch.Tensor
3 Likes

Installing torch==1.8.1 did not work for me as the installed version of torchvision requires torch 1.9.0. Changing the code as suggested by @ehddnr7471 worked for me, but I ran into another problem:

ModuleNotFoundError: No module named 'tensorboard'

which was fixed with pip install tensorboard. Then I ran into a CUDA problem which I assume is unrelated to this issue.

1 Like