Describe the bug
$ python run_MountainCar.py
Discrete(3)
Box(2,)
[0.6 0.07]
[-1.2 -0.07]
2019-02-11 17:32:47.428166: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
File "run_MountainCar.py", line 33, in
env.render()
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/gym/envs/classic_control/mountain_car.py", line 75, in render
from gym.envs.classic_control import rendering
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 23, in
from pyglet.gl import *
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 239, in
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/window/__init__.py", line 1896, in
gl._create_shadow_window()
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 208, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 166, in __init__
super(XlibWindow, self).__init__(args, *kwargs)
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/window/__init__.py", line 571, in __init__
self._create()
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 263, in _create
self.context.attach(self.canvas)
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 323, in attach
self.set_current()
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 328, in set_current
super(XlibContext13, self).set_current()
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/gl/base.py", line 301, in set_current
gl_info.set_active_context()
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/gl/gl_info.py", line 94, in set_active_context
self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value)
File "/home/lucas/miniconda3/envs/tensorflow/lib/python3.6/site-packages/pyglet/gl/lib.py", line 105, in errcheck
raise GLException(msg)
pyglet.gl.lib.GLException: b'invalid operation'
To Reproduce
Steps to reproduce the behavior:
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install bzip2
bash Downloads/Miniconda3-latest-Linux-x86_64.sh # miniconda
sudo apt-get -y install python-opengl
conda create -n tensorflow python=3.6
conda activate tensorflow
pip install --ignore-installed --upgrade tensorflow
conda install -c menpo opencv3
conda install matplotlib pandas scikit-learn scikit-image ipython notebook h5py
python -m pip install --upgrade pip
pip install tflearn --upgrade
pip install tensorpack gym[all]
pip install gym
pip install --no-index -f https://github.com/Kojoley/atari-py/releases atari_py
python run_MountainCar.py
Deep Q network,
Using:
Tensorflow: 1.0
gym: 0.8.0
"""
import gym
from RL_brain import DeepQNetwork
env = gym.make('MountainCar-v0')
env = env.unwrapped
print(env.action_space)
print(env.observation_space)
print(env.observation_space.high)
print(env.observation_space.low)
RL = DeepQNetwork(n_actions=3, n_features=2, learning_rate=0.001, e_greedy=0.9,
replace_target_iter=300, memory_size=3000,
e_greedy_increment=0.0002,)
total_steps = 0
for i_episode in range(10):
observation = env.reset()
ep_r = 0
while True:
env.render()
action = RL.choose_action(observation)
observation_, reward, done, info = env.step(action)
position, velocity = observation_
# the higher the better
reward = abs(position - (-0.5)) # r in [0, 1]
RL.store_transition(observation, action, reward, observation_)
if total_steps > 1000:
RL.learn()
ep_r += reward
if done:
get = '| Get' if observation_[0] >= env.unwrapped.goal_position else '| ----'
print('Epi: ', i_episode,
get,
'| Ep_r: ', round(ep_r, 4),
'| Epsilon: ', round(RL.epsilon, 2))
break
observation = observation_
total_steps += 1
RL.plot_cost()
Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Basic Troubleshooting Checklist
[ ] I have searched Google for the error message.
[ ] I have checked official WSL troubleshooting documentation: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#confirm-wsl-is-enabled.
[ ] I have searched the official Microsoft WSL issues page: https://github.com/Microsoft/WSL/issues.
[ ] I have searched the WLinux issues page: https://github.com/WhitewaterFoundry/WLinux/issues.
[ ] I have reset WLinux: Settings->Apps->Apps & features->WLinux->Advanced Options->Reset.
[ ] I have disabled and re-enabled WSL in Windows Features.
[ ] I have run Windows 10 updates and restarted.
What other troubleshooting have you attempted?
Insert here:
WLinux Version
Find: Settings->Apps->Apps & features->WLinux->Advanced Options->Version.
Insert here: WLinux version 1.1.28.0
Windows Build
Run 'systeminfo | findstr /C:"OS"' in Command Prompt and insert here:
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.17763 N/A Build 17763
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
BIOS Version: Microsoft Corporation 234.2291.769, 7/19/2018
For help on retrieving: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#check-your-build-number
Hello,
Try with:
export LIBGL_ALWAYS_INDIRECT=0
Regards
Thanks.
The right command compatible to most mesa versions is:
export -n LIBGL_ALWAYS_INDIRECT
or
env -u LIBGL_ALWAYS_INDIRECT python run_MountainCar.py
Most helpful comment
Hello,
Try with:
export LIBGL_ALWAYS_INDIRECT=0Regards