legorovers / pirover_simulator

A python based simulator for the 4tronix Inition and Pi2Go robots.
GNU General Public License v3.0
8 stars 39 forks source link

pyglet.gl.ContextException: Unable to share contexts #27

Closed JamesDownes5 closed 1 month ago

JamesDownes5 commented 1 month ago

Python 3.11.9 numpy 2.1.2 pip 24.2 pyglet 2.0.9 setuptools 65.5.0 tk 0.1.0

Traceback (most recent call last):
  File "c:\Users\james\pirover_simulator\pysim.py", line 48, in <module>
    simulator = Simulator(selected_file, selected_robot, start_window)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\james\pirover_simulator\src\windows\simulator.py", line 41, in __init__
    super(Simulator, self).__init__(self.dyn_assets.background_image.width, self.dyn_assets.background_image.height,
  File "C:\Users\james\pirover_simulator\.venv\Lib\site-packages\pyglet\window\win32\__init__.py", line 104, in __init__
    super(Win32Window, self).__init__(*args, **kwargs)
  File "C:\Users\james\pirover_simulator\.venv\Lib\site-packages\pyglet\window\__init__.py", line 578, in __init__
    self._create()
  File "C:\Users\james\pirover_simulator\.venv\Lib\site-packages\pyglet\window\win32\__init__.py", line 258, in _create
    self.context.attach(self.canvas)
  File "C:\Users\james\pirover_simulator\.venv\Lib\site-packages\pyglet\gl\win32.py", line 255, in attach
    super(Win32ARBContext, self).attach(canvas)
  File "C:\Users\james\pirover_simulator\.venv\Lib\site-packages\pyglet\gl\win32.py", line 202, in attach
    raise gl.ContextException('Unable to share contexts.')
pyglet.gl.ContextException: Unable to share contexts.
JamesDownes5 commented 1 month ago

Update Pyglet from 2.0.9 to 2.0.18 pip install --upgrade pyglet Then issue #14 occurs

andrewgait commented 1 month ago

I'm seeing this problem too (Windows 11, using anaconda for virtual environment).

A quick google suggests that the problem might be a graphics driver issue, but as @JamesDownes5 says, upgrading pyglet to 2.0.18 fixes this issue, but then the other issue occurs.

JamesDownes5 commented 1 month ago

Apparently this is a graphics driver issue: https://github.com/psychopy/psychopy/issues/1579 But there's no way anyone's downgrading their graphics drivers on windows just to get this working. We'll just have to find what the difference is between Pyglet 2.0.9 and Pyglet 2.0.10 and implement the fix

louiseadennis commented 1 month ago

I fear you are correct. The good news is that, given it displays at least something correctly, we're probably not dealing with fundamentally incompatible bits of software but it might well involve a major refactor.