Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RL problem on COLAB for 'gym.envs.box2d' has no attribute 'LunarLander'

What can I do in Colab to work with the env "LunarLander-v2" from OPENAI-gym. I have installed BOX2D and box2d-py but always return the same error:

AttributeError: module 'gym.envs.box2d' has no attribute 'LunarLander'

This passage in my local machine works, but on Colab not. What could be a solution ?

Versions: Python:3.6 - Gym:0.17.2 - BOX2D:2.3.10

like image 588
Jellyfish Avatar asked Sep 03 '25 07:09

Jellyfish


1 Answers

Important part is to create a new Colab notebook, Click on File -> New notebook. On a new (fresh) Colab execute these:

!pip3 install box2d-py
!pip3 install gym[Box_2D]
import gym
env = gym.make("LunarLander-v2")

The gym is installed by default in the new notebook however you have to install the box2d-py and gym[Box_2D]. Please close the current notebook if you have encountered the 'gym.envs.box2d' has no attribute 'LunarLander' error. Simply use a new notebook and go on with above procedure of pip install. It will work!

like image 180
Trees Avatar answered Sep 04 '25 22:09

Trees



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!