On the latest Arch Linux, I hit an obscure Qt error if I try and run an OpenAI Gym example after installing the Atari game suite. It seems to be caused by a conflict between Qt and matplotlib.
Steps to Reproduce
Install LEAP in a venv: make venv && source venv/bin/activate && make depend && make setup)
At this point the Cartpole example should run fine: python examples/openai_gym.py evolve
Install the Atari environments: pip install gym[atari]
The Cartpole example will now fail: python examples/openai_gym.py evolve
Running Cartpole without evolution will still work: python examples/openai_gym.py keyboard
Expected Behavior
Both matplotlib and OpenAI gym visualizations should run at the same time in separate windows.
More Info
The error I get is as follows:
$ python examples/openai_gym.py evolve --env SpaceInvaders-ram-v4
...
QObject::moveToThread: Current thread (0x55901bdb9000) is not the object's thread (0x55901c34c6e0).
Cannot move to target thread (0x55901bdb9000)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/eric/repos/LEAP/venv/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc.
Aborted (core dumped)
Interestingly, the error is not thrown when the Gym environment tries to run, but rather when we call plt.figure() to set up the visualization probes for the example.
It seems that gymruns something (if and only if [atari] is installed, even if unused) that clashes with Matplotlib: examples that only use Matplotlib or only use gym work fine, but my example that uses both does not.
A possible culprit is OpenCV, which is a dependency of gym[atari] and has been known to cause similar Qt errors in other contexts.
On the latest Arch Linux, I hit an obscure Qt error if I try and run an OpenAI Gym example after installing the Atari game suite. It seems to be caused by a conflict between Qt and matplotlib.
Steps to Reproduce
make venv && source venv/bin/activate && make depend && make setup
)python examples/openai_gym.py evolve
pip install gym[atari]
python examples/openai_gym.py evolve
python examples/openai_gym.py keyboard
Expected Behavior
Both matplotlib and OpenAI gym visualizations should run at the same time in separate windows.
More Info
The error I get is as follows:
Interestingly, the error is not thrown when the Gym environment tries to run, but rather when we call
plt.figure()
to set up the visualization probes for the example.It seems that
gym
runs something (if and only if[atari]
is installed, even if unused) that clashes with Matplotlib: examples that only use Matplotlib or only usegym
work fine, but my example that uses both does not.A possible culprit is OpenCV, which is a dependency of
gym[atari]
and has been known to cause similar Qt errors in other contexts.