Skip to content

Troubleshooting guide

justheuristic edited this page Feb 1, 2019 · 1 revision

Gym: If gym fails to upload your results and throws an exception like

Error: Still have an open monitor on CartPole-v0, CartPole-v0. You must run 'env.close()' before uploading.

even after you’ve closed the env, try to open another python console and upload from there.

Gym+joblib: To use multiple threads to run game sessions joblib may be used. But it may work improperly (game sessions are same (absolutely) over several threads. To make game sessions unique: In the process that plays the game create new environment: env = gym.make('Taxi-v1') (don't forget to close the env when it's done) 2. Generate random seed for each game session: np.random.seed()

To decrease overhead of environment creation, you can create only per-thread instance of gym env, for example: import threading def session(): loc_data = threading.local() if not hasattr(loc_data, "env"): loc_data.env = gym.make("LunarLander-v2") env = loc_data.env # here work with env

generate sessions

sessions = joblib.Parallel(n_jobs)(joblib.delayed(generate_session)() for _ in range(n_samples))

CartPole-v0: Sometimes, the default gym env has max reward (e.g. session length) is constrained by 200. To fix that try to do something like env = gym.make(‘CartPole-v0’).env

no GLX on GPU nodes

Contributed by Sergey Kolesnikov

GLXInfoException: pyglet requires an X server with GLX Solution: re-install GPU drivers without opengl. https://github.com/openai/gym/issues/366 https://davidsanwald.github.io/2016/11/13/building-tensorflow-with-gpu-support.html

Box2d swig fix Contributed by Sergey Kolesnikov

If you use old swig lib for LunarLander-v2, you may get an error. See this issue for solution: https://github.com/openai/gym/issues/100

PS.Cause it was hard to find in notebook.