openai / universe

Universe: a software platform for measuring and training an AI's general intelligence across the world's supply of games, websites and other applications.
https://universe.openai.com
MIT License
7.45k stars 956 forks source link

[Archlinux] X Error of failed request: BadMatch #95

Closed lenage closed 7 years ago

lenage commented 7 years ago

Hi I tried to run example in README on Archlinux with Python 3.5

Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  2 2016, 17:53:06) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import gym
   ...: import universe  # register the universe environments
   ...: 
   ...: env = gym.make('flashgames.DuskDrive-v0')
   ...: env.configure(remotes=1)  # automatically creates a local docker container
   ...: observation_n = env.reset()
   ...: 
   ...: while True:
   ...:   action_n = [[('KeyEvent', 'ArrowUp', True)] for ob in observation_n]  # your agent here
   ...:   observation_n, reward_n, done_n, info = env.step(action_n)
   ...:   env.render()
   ...: 

but it's show below error

universe-veyUFH-0 | [2017-01-05 17:30:57,979] [INFO:universe.rewarder.remote] Client connecting: peer=tcp4:127.0.0.1:39616 observer=False
universe-veyUFH-0 | [2017-01-05 17:30:57,979] [INFO:universe.rewarder.remote] WebSocket connection established
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  42 (X_SetInputFocus)
  Serial number of failed request:  188
  Current serial number in output stream:  190

Versions

Linux lenbox 4.8.13-1-ARCH #1 SMP PREEMPT Fri Dec 9 07:24:34 CET 2016 x86_64 GNU/Linux
Python 3.5.2 :: Continuum Analytics, Inc.
Name: gym
Version: 0.7.0
Summary: The OpenAI Gym: A toolkit for developing and comparing your reinforcement learning agents.
Home-page: https://github.com/openai/gym
Author: OpenAI
Author-email: gym@openai.com
License: UNKNOWN
Location: /home/ox66/.anaconda3/envs/openai/lib/python3.5/site-packages
Requires: numpy, six, pyglet, requests
---
Name: numpy
Version: 1.11.2
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: NumPy Developers
Author-email: numpy-discussion@scipy.org
License: BSD
Location: /home/ox66/.anaconda3/envs/openai/lib/python3.5/site-packages
Requires

Xorg version: xorg-server 1.18.4-1

Any suggestions

tlbtlbtlb commented 7 years ago

Try it under regular (not Iron) Python, with the program in a file instead of typing interactively. Iron Python does something strange with X11 and threads.

lenage commented 7 years ago

@tlbtlbtlb Thanks, I just tried without regular iPython, and also get same error, (I'm using Xmonad as WM, does that matter?)

tlbtlbtlb commented 7 years ago

Does your system run OpenGL? If you run glxgears, do you see gears spinning on screen? If not, that's the problem.

If you drop the call to env.render(), you can watch the environment run by pointing your browser to http://localhost:15900 instead.

lenage commented 7 years ago

seems it's a issue of Xmonad, I switch to Openbox and it works for me, Thanks @tlbtlbtlb