hardmaru / WorldModelsExperiments

World Models Experiments
608 stars 171 forks source link

'CarRacingWrapper' object has no attribute '_render' #9

Closed keithmgould closed 5 years ago

keithmgould commented 5 years ago

Hello! I'm trying to run the trained model:

python model.py render log/carracing.cma.16.64.best.json

The error is:

  File "model.py", line 290, in <module>
    main()
  File "model.py", line 280, in main
    train_mode=False, render_mode=render_mode, num_episode=1)
  File "model.py", line 175, in simulate
    obs = model.env.reset()
  File "/Users/keithgould/miniconda3/envs/py34/lib/python3.4/site-packages/gym/envs/box2d/car_racing.py", line 292, in reset
    return self.step(None)[0]
  File "/Users/keithgould/miniconda3/envs/py34/lib/python3.4/site-packages/gym/envs/box2d/car_racing.py", line 304, in step
    self.state = self._render("state_pixels")
AttributeError: 'CarRacingWrapper' object has no attribute '_render'

I suspect the car_racing.py module is just fine, and there is something in my environment that is not right (details below). I'm just not sure.

As an added piece of info, I was able to run the car racing environment for manual control via:

python env.py 

And the above worked just fine.

Environment info:

I'm on a MacBook Pro, 10.13.6. I'm running an environment via miniconda.

# Name                    Version                   Build  Channel
absl-py                   0.5.0                     <pip>
astor                     0.7.1                     <pip>
ca-certificates           2018.03.07                    0    anaconda
certifi                   2018.8.24                 <pip>
chardet                   3.0.4                     <pip>
future                    0.16.0                    <pip>
gast                      0.2.0                     <pip>
grpcio                    1.15.0                    <pip>
gym                       0.9.7                     <pip>
idna                      2.7                       <pip>
intel-openmp              2019.0                      118    anaconda
Markdown                  2.6.11                    <pip>
mkl                       2017.0.4             h1fae6ae_0    anaconda
numpy                     1.11.3                   py34_0    anaconda
numpy                     1.14.5                    <pip>
openssl                   1.0.2p               h1de35cc_0    anaconda
Pillow                    5.2.0                     <pip>
pip                       9.0.1                    py34_1
protobuf                  3.6.1                     <pip>
pybox2d                   2.3.1post2               py34_0    kne
pyglet                    1.3.2                     <pip>
python                    3.4.5                         0
readline                  6.2                           2
requests                  2.19.1                    <pip>
scipy                     0.18.1              np111py34_1    anaconda
setuptools                27.2.0                   py34_0
six                       1.11.0                    <pip>
sqlite                    3.13.0                        0
tensorboard               1.10.0                    <pip>
tensorflow                1.10.1                    <pip>
termcolor                 1.1.0                     <pip>
tk                        8.5.18                        0
urllib3                   1.23                      <pip>
Werkzeug                  0.14.1                    <pip>
wheel                     0.29.0                   py34_0
xz                        5.2.4                h1de35cc_4
zlib                      1.2.11               hf3cbc9b_2

Thank you for any thoughts!

hardmaru commented 5 years ago

Hi @keithmgould

Just saw this. Are you able to get this to work in the end?

hardmaru commented 5 years ago

Hmm, I don't seem to have this problem on my side. Sorry!

garibarba commented 5 years ago

I fixed this on my side by using gym v0.9.5. The newer version v0.9.6 would not work.