I'm trying to train a DQN in google colab so that I can test the performance of the TPU. Unfortunately, I get the following error:
import gym
env = gym.make('LunarLander-v2')
AttributeError: module 'gym.envs.box2d' has no attribute 'LunarLander'
I know this is a common error, and I had this before on my local machine. I was able to fix it with commands like:
!pip install box2d box2d-kengz
!pip install Box2D
!pip install -e '.[box2d]'
While this worked on my local machine, on google colab is it not. I can't get rid of the error. Does anyone have a solution?
On a fresh colab, I simply installed box2d-py via
!pip3 install box2d-py
and it worked.
Try it on a new colab it should work.
You need to execute at the beginning a cell with the code:
!sudo apt-get install swig build-essential python-dev python3-dev
This should solve your problem and you will be able to install this library in google colab
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.