Kivy: Unable to find any valuable Window provider (undefined symbol: glGetFramebufferAttachmentParameteriv)

Created on 23 Aug 2017  Â·  23Comments  Â·  Source: kivy/kivy

* prepare a short, runnable example that reproduces the issue
* reproduce the problem with the latest development version of Kivy
* double-check that the issue is indeed a bug and not a support request

Versions

  • Python: Python 3.5.2
  • OS: Ubuntu 16.04.3 LTS
  • Kivy: v1.10.0
  • Kivy installation method:

    • Instructions from https://kivy.org/docs/installation/installation-linux.html#installation-in-a-virtual-environment

    • First install dependencies: python-pip build-essential git python python-dev ffmpeg libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev zlib1g-dev

    • Further dependencies: libgstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good

    • Install Cython: pip install Cython==0.25.2

    • Install Pillow: pip install image

    • Install Kivy: pip install kivy

Description

I'm trying to install kivy on Ubuntu 16.04, which is running in a Virtual Box (Version 5.1.26r117224 (Qt5.6.2) ). This is the latest version of Virtual Box. The Host OS is Windows 10.

Disabling the 3D acceleration leads to another SDL2 error:

sdl2 - RuntimeError: b'GLX is not supported'
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/__init__.py", line 67, in core_select_lib
    cls = cls()
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 140, in __init__
    super(WindowSDL, self).__init__()
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/window/__init__.py", line 899, in __init__
    self.create_window()
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 269, in create_window
    self.fullscreen, resizable, state)
  File "kivy/core/window/_window_sdl2.pyx", line 142, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (/tmp/pip-build-jka1zi38/kivy/kivy/core/window/_window_sdl2.c:2782)
  File "kivy/core/window/_window_sdl2.pyx", line 57, in kivy.core.window._window_sdl2._WindowSDL2Storage.die (/tmp/pip-build-jka1zi38/kivy/kivy/core/window/_window_sdl2.c:1872)

So maybe the error is anyhow related to the 3D acceleration (device), used by VirtualBox?

Code

Reproduce the issue in interactive python console:

>>> import kivy
>>> from kivy.core.window import Window

Full Error Output

>>> import kivy
Purge log fired. Analysing...
Purge finished!
[INFO   ] [Logger      ] Record log in /home/aadc/.kivy/logs/kivy_17-08-23_1.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609]
>>> from kivy.core.window import Window
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
egl_rpi - ImportError: cannot import name 'bcm'
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module>
    from kivy.lib.vidcore_lite import bcm, egl

sdl2 - ImportError: /home/aadc/tf_python/lib/python3.5/site-packages/kivy/graphics/cgl_backend/cgl_gl.cpython-35m-x86_64-linux-gnu.so: undefined symbol: glGetFramebufferAttachmentParameteriv
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/__init__.py", line 67, in core_select_lib
    cls = cls()
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 140, in __init__
    super(WindowSDL, self).__init__()
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/window/__init__.py", line 899, in __init__
    self.create_window()
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/window/window_sdl2.py", line 269, in create_window
    self.fullscreen, resizable, state)
  File "kivy/core/window/_window_sdl2.pyx", line 110, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (/tmp/pip-build-jka1zi38/kivy/kivy/core/window/_window_sdl2.c:2466)
  File "kivy/graphics/cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name (/tmp/pip-build-jka1zi38/kivy/kivy/graphics/cgl.c:3044)
  File "kivy/graphics/cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name (/tmp/pip-build-jka1zi38/kivy/kivy/graphics/cgl.c:2879)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "kivy/graphics/cgl_backend/cgl_glew.pyx", line 9, in init kivy.graphics.cgl_backend.cgl_glew (/tmp/pip-build-jka1zi38/kivy/kivy/graphics/cgl_backend/cgl_glew.c:3260)

x11 - ImportError: No module named 'kivy.core.window.window_x11'
  File "/home/aadc/tf_python/lib/python3.5/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)

>>> quit()
graphics High

Most helpful comment

pip install pygame
fixed the issue for me

Ubuntu-linux 17.10 64bit
Python 3.6.3

pip freeze
buildozer==0.35.dev0
certifi==2018.4.16
chardet==3.0.4
Cython==0.28.2
docutils==0.14
idna==2.6
Kivy==1.10.0
Kivy-Garden==0.1.4
pexpect==4.5.0
plyer==1.3.1.dev0
ptyprocess==0.5.2
pygame==1.9.3
Pygments==2.2.0
requests==2.18.4
urllib3==1.22
virtualenv==15.2.0

All 23 comments

Another note: Remove and Reinstall the VBox Guest Extension did not solve the issue.

I'm trying to install kivy on Ubuntu 16.04, which is running in a Virtual Box (Version 5.1.26r117224 (Qt5.6.2) ).

I have the exact same error on all virtualbox 5.x I tried (win7pro), I've never been able to get it working after upgrading from 4.x. In contrast to your report though, disabling 3d acceleration has been a reliable workaround for me since day one, so I didn't extensively research it or anything..

The glxinfo output looks okay for me, and I can run other OpenGL apps (with caveats; see below)..

$ glxinfo | grep OpenGL
OpenGL vendor string: Humper
OpenGL renderer string: Chromium
OpenGL version string: 2.1 Chromium 1.9
OpenGL shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL extensions:

I don't know anything about internals of the kivy cgl or gl redirection, etc, so not sure where the symbol is supposed to be defined, but it is exported in the object file:

$ objdump -t /home/terje/kivy/kivy/graphics/cgl_backend/cgl_gl.cpython-35m-x86_64-linux-gnu.so|grep glGetFramebufferAttachmentParameteriv
0000000000000000       F *UND*  0000000000000000              glGetFramebufferAttachmentParameteriv

Downgrading Kivy to 1.9.1 results in a different error message for me, seems identical to #4459: ImportError: /home/terje/kivy/kivy/graphics/texture.cpython-35m-x86_64-linux-gnu.so: undefined symbol: glGenerateMipmap. Going all the way back to 1.8 doesn't work either (but I ran 1.8 with 3d acceleration on virtualbox 4.x for a long time on the same host)

Remove and Reinstall the VBox Guest Extension did not solve the issue.

On a couple of occasions I've gotten Kivy to start with 3d acceleration enabled (ie getting past the undefined symbol), by doing

  1. Boot VM (Kivy crashes with undefined symbol)
  2. Uninstall + reinstall guest additions, without reboot
  3. Start Kivy app

The app starts and I can see it draw the window, but then everything goes completely bonkers. X can't be used at all after this; weird lag, broken graphics, no response to input, etc. However, terminating X restores to a seemingly working state (I have ctrl-alt-backspace bound still). Note that I managed to completely corrupt a VM by repeating the uninstall-reinstall of guest additions a few times (not sure about exact procedure). Couldn't even revert to a snapshot after this, so be careful experimenting with a "real" VM with data...

The weirdo crash state is consistently reproducible on my system by running MegaGlest. The game starts and runs just fine, clearly with OpenGL working, but it crashes on exit and leaves the VM in the same (or at least very similar) as occurs when I get Kivy past the undefined symbol error. Could you maybe try to reproduce this on your system? (sudo apt-get install megaglest; megaglest). I've tried a couple of other games etc and didn't see this.

Do you by any chance have an nvidia graphics card? At some point in the past I came across an indication that it may be related to that, but it didn't lead me anywhere, and I don't have a reference handy..

I have the same issue for ubuntu 14.04, 15.04, 15.10, 16.04, debian 9, 8 and 7, Centos 7, Devuan jessie, and some version of Fedora.

Seeing the same here on Linux Mint 18.2 x64, which is based on Ubuntu (uname -a excerpt: 4.10.0-33-generic #37~16.04.1-Ubuntu). My VirtualBox is v5.1.28.

First of all, I'm by no means an expert on anything involving OpenGL. However, I saw that in the error log of my test script one line of it complains about:

File "kivy/graphics/cgl_backend/cgl_glew.pyx", line 9, in init kivy.graphics.cgl_backend.cgl_glew (/tmp/pip-build-05agald7/kivy/kivy/graphics/cgl_backend/cgl_glew.c:3260)

Although in the init log messages, there's no mention about _glew_, it says it's ignoring _sdl2_ for some reason:

[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.

So I tried instead:

(.venv) ... $ KIVY_GL_BACKEND=sdl2 python src/main.py

and that seemed to get me a window at least. Although the notification [INFO ] [Window ] Provider: sdl2(['window_egl_rpi'] ignored) is still there. :thinking:

TL;DR / Possible Workaround:

According to the docs ([1], [2]) you should also be able to set that inside your application, like so:

import os
os.environ['KIVY_GL_BACKEND'] = 'sdl2'
import kivy

I don't have time to investigate it any further at the moment, but hope this helps someone.

I can confirm that (a variation of) the "TL;DR / possible workaround" from the previous comment works for me:

$ KIVY_GL_BACKEND=sdl2 python3 main.py

But _this_ fails (Ubuntu 16.04.3 LTS in a VirtualBox 5.1.6 r110634 guest):

$ python3 main.py
[INFO   ] [Logger      ] Record log in /home/evadeflow/.kivy/logs/kivy_17-10-03_7.txt
[INFO   ] [Kivy        ] v1.9.2-dev0
[INFO   ] [Python      ] v3.5.2 (default, Aug 18 2017, 17:48:00) 
[GCC 5.4.0 20160609]
[INFO   ] [Factory     ] 193 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
egl_rpi - ImportError: cannot import name 'bcm'
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module>
    from kivy.lib.vidcore_lite import bcm, egl

sdl2 - ImportError: /usr/lib/python3/dist-packages/kivy/graphics/cgl_backend/cgl_gl.cpython-35m-x86_64-linux-gnu.so: undefined symbol: glGetFramebufferAttachmentParameteriv
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 67, in core_select_lib
    cls = cls()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 139, in __init__
    super(WindowSDL, self).__init__()
  File "/usr/lib/python3/dist-packages/kivy/core/window/__init__.py", line 845, in __init__
    self.create_window()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 263, in create_window
    self.fullscreen, resizable, state)
  File "kivy/core/window/_window_sdl2.pyx", line 110, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy/core/window/_window_sdl2.c:2172)
  File "kivy/graphics/cgl.pyx", line 50, in kivy.graphics.cgl.cgl_get_backend_name (kivy/graphics/cgl.c:2771)
  File "kivy/graphics/cgl.pyx", line 58, in kivy.graphics.cgl.cgl_get_backend_name (kivy/graphics/cgl.c:2623)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "kivy/graphics/cgl_backend/cgl_glew.pyx", line 9, in init kivy.graphics.cgl_backend.cgl_glew (kivy/graphics/cgl_backend/cgl_glew.c:3044)

x11 - ImportError: No module named 'kivy.core.window.window_x11'
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)

[CRITICAL] [App         ] Unable to get a Window, abort.

I can also confirm that unchecking Enable 3D Acceleration in the settings for this virtual machine also allows the app to load successfully.

I'm also encountering the same problem on Ubuntu 16.04 .
while the minimal app(first Example from the official doc) works fine with python2.7 while it throws an error for python3 . Here is a snapshot from the command 'python3 main.py'. I am a newbie in Kivy so can anybody help me !!
errore

@devanshhu Can you put this code in your main.py before any other Kivy imports:

import os
os.environ['KIVY_GL_BACKEND'] = 'sdl2'

from kivy.core.window import Window

@pythonic64 I was facing the same issue. Your solution solved the problem on my Windows machine, thank-you.

It seems that this symbol "glGetFramebufferAttachmentParameteriv" is not in OpenGL 2.0 as that the minimum we actually ask for Desktop. But it is in OpenGL ES 2.0.

Using GL_BACKEND sdl2 works as this implementation use a dynamic method to fetch GL symbol, while the default one use a static method.

Actions to do:

  • prefer dynamic symbol (sdl2) if sdl2 window is actually used
  • fix static gl implementation to not ask glGetFramebufferAttachmentParameteriv if not available (move it to cgl_glew, and use dynamic binding same as other desktop gl symbol.)

(Ref: https://www.khronos.org/opengl/wiki/GLAPI/glGetFramebufferAttachmentParameter)

I think this has something to do with my RPi, listed below. When I tried the "GL_BACKEND' sdl2 solution, I got segmentation fault, probably because it had already loaded sdl2. How can I stop the image provider sdl2 from loading?

https://github.com/kivy/kivy/issues/5581

@frankgould As I wrote previously, I don't know a lot about OpenGL. However, to me it doesn't sound like your problem is related to this issue.

The workaround above was about how to set an environment variable to force a certain backend, and how to do that from within your app.

Note that in the second link (CGL: standard C interface for OpenGL) it is written (emphasis mine):

sdl2 – Available on Windows/unix

(so that might be ok since you're on Jessie) and

KIVY_GRAPHICS – Forces OpenGL ES2 when it is gles. OpenGL ES2 is always used on the android, ios, rpi, and mali OSs

But after a quick glance at your issue #5581, in your log I don't see anything related to that (using SDL vs. the default). So you might not have a choice on Raspberry Pi and I don't know if you should try to set that environment variable. I don't own one, so I can't test it, sorry.

(Taking a shot in the dark here: To better triage the problem, try to use a stable release and the same Cython version as they recommend, then see if anything changes at all. I have had problems with Cython versions other than the recommended one, and that wasn't on a more exotic OS like the RPi.)

Thank you dolang for your comments and suggestions. Today, I tried two versions of Cython but only one kivy build with an older version and all resulted in the same problem as pasted below.

FBO Initialization failed: Incomplete attachment (36054)

The reason I think these are related to the OpenGL Invalid Operation errors I'm also seeing are because tito's comment about glGetFramebufferAttachmentParameteriv above and the migration to OpenGL2.0. My understanding is that FBO is Frame Buffer Object and I'm assuming the actions tito mentions might fix the symptoms I'm experiencing. One person recommended not using sdl2 and that's why I found this post trying to learn how to stop using it.

I really think this is a kivy dev issue and would like to find someone who can help me with this. I'm also offering a FREE Raspberry Pi 3 for anyone who can help me find a solution!

@frankgould

The reason I think these are related to the OpenGL Invalid Operation errors I'm also seeing are because tito's comment about glGetFramebufferAttachmentParameteriv above and the migration to OpenGL2.0

Ultimately, your guess is as good as mine (or better, you can actually test stuff on an RPi ;) but what I gathered from tito's post is that the default backend tries to access an OpenGL API whereas SDL is a bit smarter and (I assume in addition) probes for a OpenGL ES API. These are not quite the same.

And I don't know why Virtualbox would only run OpenGL ES, either, I haven't looked into it any further since then. Also, I get [INFO ] [GL ] OpenGL version <b'2.1 Chromium 1.9'> in my VM which would indicate it's not OpenGL ES, so... :thinking:

Anyway, according to the docs RPi only uses the OpenGL ES, that's why I'm assuming it won't help you any to fiddle with those settings, and this bug is unrelated (obviously doesn't hurt to try, though).

One person recommended not using sdl2 and that's why I found this post trying to learn how to stop using it.

I think the first log you posted in your report indicates that sdl2 isn't actually used? If you don't specify anything then the default on *nix should be gl, as in KIVY_GL_BACKEND=gl. On my VM in "sdl2 mode" (as in KIVY_GL_BACKEND=sdl2) I get a [INFO ] [GL ] Backend used <sdl2> in my log, whereas you have [INFO ] [GL ] Backend used <gl> in the log attached there.

I'm also offering a FREE Raspberry Pi 3 for anyone who can help me find a solution!

That's a nice offer, but I might have a better idea: As there are not too many people who have the necessary knowledge and the hardware to properly troubleshoot this, it would probably help a lot to instead create a ~KVM~ or ~Virtualbox~ image with your setup (or provide instructions for it).

If you can reproduce the problem in a VM*, people who don't have an RPi would be able to help you much more easily.

But we should probably move that to over your own issue, then.

Edit: If you're going to try to put this together on a VM, KVM/Virtualbox won't do because RPi is ARM. You'd have to find instructions for QEMU. Confusingly, sometimes KVM and QEMU are mentioned together, because they work with each other. Anyway, what we'd need is to run ARM on x86 (the EMU part in QEMU stands for emulator), and "just using a VM" won't do. I'm looking into that for a bit.


*No guarantees, though — stuff is tricky as you can see, and in this specific bug report here the cause is trying Kivy on a VM instead of a real machine.

On Windows, glew and sdl2 are required as dependencies. I had the same problem. Installing all the dependencies

python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew

pip install pygame
fixed the issue for me

Ubuntu-linux 17.10 64bit
Python 3.6.3

pip freeze
buildozer==0.35.dev0
certifi==2018.4.16
chardet==3.0.4
Cython==0.28.2
docutils==0.14
idna==2.6
Kivy==1.10.0
Kivy-Garden==0.1.4
pexpect==4.5.0
plyer==1.3.1.dev0
ptyprocess==0.5.2
pygame==1.9.3
Pygments==2.2.0
requests==2.18.4
urllib3==1.22
virtualenv==15.2.0

BUT: I did not get buildozer or p4a to make android apk with python3.
So after wasting half a day I'm returning now python2.7
Terveisin, Markus

anyone found a solution to this? I'm still having it in ubuntu 18.04 gnome3

The solution hasn't changed, it's a problem with Virtualbox. You can fix it like this:

export KIVY_GL_BACKEND=sdl2

or in your code at the very start:

import os
os.environ['KIVY_GL_BACKEND'] = 'sdl2'

or disable 3D acceleration of your Virtualbox image.

actually I'm not on a VM? it's a normal install, I used kivy on ubuntu 16.04 unity with no issues but after I updated to 18.04 it started doing this.

I fixed it by updating kivy

+1 for turning off 3D acceleration in the VirtualBox machine preferences. I was getting very frustrated trying to get a Kivy app working on one of my (several) Ubuntu 16 VMs when it had worked fine on the others. I felt like Sam Jackson in Jurassic Park trying to do things that ought to work over and over again. "(Access main program...access main security...access main program grid...") In frustration I decided simply to copy across one of the VMs I knew work from a different (host) machine.

And it didn't work on the new host machine, despite being an identical guest. So the problem was clearly with the host and/or the VirtualBox setup itself. Turning off 3D acceleration did the trick.

this is still a problem on VirtualBox with Ubuntu 18.04.3 with Kivyv 1.11.1. I cannot include a dependency in another open source project that has issues.

kivy should work out of the box on the basic examples. when will this be fixed???

I've updated to v1.11.1 via the ppa but still getting the same error.

@comperem did it work for you if added sdl2 as the gl backend like in the example above? Otherwise it's an unrelated issue.

Thanks @paapu88 !
Installing pygame to be used instead default sdl2 worked for me on Python 3.7.3, Kivy 1.11.1, Debian 10 over VM with 3d acceleration enabled.

pip3 install pygame

However i get some deprecated warning flags: _Pygame has been deprecated and will be removed after 1.11.0: Call to deprecated function __init__ in /home/kkuser/.local/lib/python3.7/site-packages/kivy/core/window/window_pygame.py line 42.Called from /home/kkuser/.local/lib/python3.7/site-packages/kivy/core/__init__.py line 71 by core_select_lib()._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ozc picture ozc  Â·  23Comments

frankgould picture frankgould  Â·  53Comments

pythonic64 picture pythonic64  Â·  26Comments

nim4n picture nim4n  Â·  38Comments

JaimieDodd picture JaimieDodd  Â·  29Comments