DQN-tensorflow icon indicating copy to clipboard operation
DQN-tensorflow copied to clipboard

Error! TimeLimit' object has no attribute 'ale'

Open tangyudi opened this issue 9 years ago • 7 comments

I run this code in cpu and this error occurred.

TimeLimit' object has no attribute 'ale' Can anyone show me how to solve this matter? Thank you !

tangyudi avatar Mar 16 '17 10:03 tangyudi

Hi, you can just pip install gym==0.7.0 solve this problem. This is because new gym 0.8.0 released and it is hard to use for this code.

Lan1991Xu avatar Mar 16 '17 21:03 Lan1991Xu

@Lan1991Xu Thanky you! Can I test with this check point? When I use python main.py --is_train=False --display=True,it occur a load failed error.

tangyudi avatar Mar 17 '17 07:03 tangyudi

I'm also running into this problem. How would we use this for the latest version of gym?

DanielTakeshi avatar Mar 29 '17 19:03 DanielTakeshi

Try to unwrap the env env = env.unwrapped

cteckwee avatar Apr 07 '17 03:04 cteckwee

Only Breakout can be applied. Try the following code.

def init(self, config): self.step_info = None

def _step(self, action): self._screen, self.reward, self.terminal, self.step_info = self.env.step(action)

def lives(self): if self.step_info is None: return 0 else: return self.step_info['ale.lives']

scratch314 avatar Apr 07 '17 10:04 scratch314

How to solve this problem? I try pip install gym==0.7.0, but it failed. In addition, I try the following code in main.py , it also failed.

def init(self, config): self.step_info = None

def _step(self, action): self._screen, self.reward, self.terminal, self.step_info = self.env.step(action)

def lives(self): if self.step_info is None: return 0 else: return self.step_info['ale.lives']

fanyuzeng avatar Feb 27 '18 13:02 fanyuzeng

I have the same issue; tried to revert gym to 0.7.4 and 0.7.3 (from repo) but then atari games will render as text. I've tried with other gym versions as well. I can only render atari envs using the latest version, but then dqn breaks. Any solution is greatly appreciated. When using latest gym version, tried to unwrap env as suggested, got into another issue: in /home/me/work/bitbucket/NeuralNetworks/My/dependencies/gym/gym/wrappers/time_limit.py error: Cannot call env.step() before calling reset()

mumbho avatar Mar 01 '18 23:03 mumbho