I am trying Atari Breakout game. It looks like it does not work well with Colab and Windows. Working on school cloud.
import gym
# Create environment
env = gym.make("BreakoutDeterministic-v4")
env.action_space # actions are integers from 0 to 3
env.reset()
done = False
score = 0
rewards=[]
while not done:
action = random.randrange(env.action_space.n) # select random action
obs, reward, done, info = env.step(action) # make action and get results
rewards.append(reward)
score += reward
env.render()
time.sleep(0.01)
env.close()
print('Score =', score)
plt.plot(rewards)
Get common errors and searched for resolution:
ImportError: Library "GLU" not found.
Error occurred while running `from pyglet.gl import *`
HINT: make sure you have OpenGL install. On Ubuntu, you can run 'apt-get install python-opengl'.
If you're running on a server, you may need a virtual frame buffer; something like this should work:
'xvfb-run -s "-screen 0 1400x900x24" python <your_script.py>'
- Official thread did not help
- Tried multiple SO solutions here
Tried so far different options, which I found online
- !pip install gym
- !pip install -f https://github.com/Kojoley/atari-py/releases atari_py
- !pip install gym[atari]
- !pip install git+https://github.com/Kojoley/atari-py.git
- !pip install pyglet==1.5.11