p5 icon indicating copy to clipboard operation
p5 copied to clipboard

NoSuchConfigException while importing p5 on Raspbian

Open friedkeenan opened this issue 8 years ago • 6 comments

Here's the whole error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/p5/sketch/base.py", line 50, in <module>
    config = screen.get_best_config(template)
  File "/usr/local/lib/python3.5/site-packages/pyglet/canvas/base.py", line 161, in get_best_config
    raise window.NoSuchConfigException()
pyglet.window.NoSuchConfigException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from p5 import *
  File "/usr/local/lib/python3.5/site-packages/p5/__init__.py", line 19, in <module>
    from .sketch import *
  File "/usr/local/lib/python3.5/site-packages/p5/sketch/__init__.py", line 19, in <module>
    from .base import *
  File "/usr/local/lib/python3.5/site-packages/p5/sketch/base.py", line 53, in <module>
    config = screen.get_best_config(template)
  File "/usr/local/lib/python3.5/site-packages/pyglet/canvas/base.py", line 161, in get_best_config
    raise window.NoSuchConfigException()
pyglet.window.NoSuchConfigException

I've tried all I can to fix it, I've searched for hours, I've enabled the experimental OpenGL drivers, I reinstalled everything involved in p5, all the standard stuff. I know you probably can't fix this, since it's probably a problem with Raspbian, but I just wanted to let you know.

friedkeenan avatar Jan 01 '18 19:01 friedkeenan

The only reason I could think of is that Pyglet can't find the required OpenGL config on Raspbian. I still don't know why this could be happening, though. The following lines in p5/sketch/base.py should account for this (I think?):

template = pyglet.gl.Config(samples_buffers=1, samples=2)
try:
    config = screen.get_best_config(template)
except pyglet.window.NoSuchConfigException:
    template = pyglet.gl.Config()
    config = screen.get_best_config(template)

In general it would be nice to have Raspbian support, so let's keep this open as an issue for now in case someone wants to take this up.

abhikpal avatar Jan 04 '18 09:01 abhikpal

Ok, so I looked at the pyglet example scripts, which work on Raspbian, and I noticed that they do a few things different in initializing the config for the window.

In graphics.py, they have double_buffer set to true when they initialize the config.

In sketch/base.py, you have

template = pyglet.gl.Config(samples_buffers=1, samples=2)

So, I changed it to this:

template = pyglet.gl.Config(samples_buffers=1, samples=2,double_buffer=True)

And that seems to work. I don't know if this affects other areas of the code or other OSes, but at least I got it working I guess

EDIT: It doesn't require the experimental GL drivers either

friedkeenan avatar Jan 06 '18 01:01 friedkeenan

Is this still an issue with the latest release?

abhikpal avatar Jul 18 '18 12:07 abhikpal

I can now import the library, but if I do run() it creates a segmentation fault

friedkeenan avatar Jul 27 '18 00:07 friedkeenan

Assuming you have installed vispy as a dependency (while installing p5), can you try running this:

import vispy
print(vispy.sys_info())

abhikpal avatar Jul 27 '18 10:07 abhikpal

Platform: Linux-4.9.35-v7+-armv7l-with-debian-8.0
Python:   3.5.2 (default, Dec 31 2017, 03:57:45)  [GCC 4.9.2]
NumPy:    1.13.3
Backend:  Pyglet
pyqt4:    None
pyqt5:    None
pyside:   None
pyglet:   pyglet 1.3.0
glfw:     glfw (3, 0, 4)
sdl2:     None
wx:       None
egl:      EGL 1.4 (DRI2) Mesa Project: OpenGL OpenGL_ES
osmesa:   None
_test:    None

App info-gathering error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/vispy/util/config.py", line 432, in sys_info
    canvas = Canvas('Test', (10, 10), show=False, app=app)
  File "/usr/local/lib/python3.5/site-packages/vispy/app/canvas.py", line 205, in __init__
    self.create_native()
  File "/usr/local/lib/python3.5/site-packages/vispy/app/canvas.py", line 222, in create_native
    self._app.backend_module.CanvasBackend(self, **self._backend_kwargs)
  File "/usr/local/lib/python3.5/site-packages/vispy/app/backends/_pyglet.py", line 211, in __init__
    screen=self._vispy_screen)
  File "/usr/local/lib/python3.5/site-packages/pyglet/window/xlib/__init__.py", line 166, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/pyglet/window/__init__.py", line 520, in __init__
    config = screen.get_best_config(config)
  File "/usr/local/lib/python3.5/site-packages/pyglet/canvas/base.py", line 161, in get_best_config
    raise window.NoSuchConfigException()
pyglet.window.NoSuchConfigException

It seems to be the same error as before

friedkeenan avatar Aug 02 '18 22:08 friedkeenan