Python Error - TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported

Dubbox picture Dubbox · Jan 24, 2020 · Viewed 8.7k times · Source

I think this is a not a programming specific bug, but is caused by some libraries.

I am transferring my project to a new PC, which I have freshly setup with anaconda etc. using python 3.7.6. Executing the task on the old machine works fine, here I have also used anaconda with python 3.7 (not sure if it was 3.7.6 but I could check this, i just used while creating the environment python=3.7).

When I now try to run my program, I receive:

Exception in Tkinter callback
Traceback (most recent call last):
...    
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.

The error is quite long, but it is caused by the following libraries: calling gym.envs which then calls some pyglet.libs

The last line in the error is

...from pyglet.libs.x11 import xlib
  File "...7/lib/python3.7/site-packages/pyglet/libs/x11/xlib.py", line 2928, in <module>
    XEHeadOfExtensionList.argtypes = [XEDataObject]

Thank you for your help! I do not know how to solve this or even start solving it.

Answer

Dubbox picture Dubbox · Jan 25, 2020

It seems like there is simply no support currently for using gym+pyglet in python version 3.7.6+.

The pyglet error is fixed in 1.4.9+ but gym is currently not compatible with those versions.

Still it is possible to simply downgrade python to 3.7.4 and everything works fine as it is supposed to do.