rlworkgroup / garage

A toolkit for reproducible reinforcement learning research.
MIT License
1.84k stars 309 forks source link

ImportError: cannot import name 'as_torch' #2292

Closed tianyma closed 3 years ago

tianyma commented 3 years ago

when I use task_sampler, an error occurred, can someone help me?

 python
Python 3.6.13 |Anaconda, Inc.| (default, Jun  4 2021, 14:25:59) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from garage.torch._functions import *
2021-07-26 20:59:48.062928: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /tools/project/eden/protobuf/lib/:/tools/project/eden/glog/lib/:/tools/project/eden/gflag/lib/:/tools/project/eden/mpc-1.1.0/lib:/tools/project/eden/gmp-6.2.0/lib:/tools/project/eden/mpfr-4.1.0/lib:/tools/project/eden/gcc_compile/lib/:/tools/project/eden/gcc_compile/lib64/:/tools/cluster-software/ssl/ssl-1.1.0g/lib:/lustre/S/matianyun/openmpi-4.1.1/lib/
2021-07-26 20:59:48.063009: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lustre/S/matianyun/garage/src/garage/torch/__init__.py", line 3, in <module>
    from garage.torch._functions import (as_torch, as_torch_dict,
  File "/lustre/S/matianyun/garage/src/garage/torch/_functions.py", line 16, in <module>
    import torch
  File "/lustre/S/matianyun/JiHuang/agent/garage/src/garage/torch/__init__.py", line 3, in <module>
    from garage.torch._functions import (as_torch, as_torch_dict,
ImportError: cannot import name 'as_torch'
>>> 
krzentner commented 3 years ago

Hi tianyma,

It looks like this might be a bug in the version of garage you're using. Is it fixed if you use garage installed from master? That functions was renamed in #2170

tianyma commented 3 years ago

Yes, it seems a version problem, I used to release the version of tag v2021.03.0, it's ok when changed to master.