Search code examples
pythonpython-3.xwindows-serviceskivypywin32

Kivy throws Open GL error while opening from a windows service


I'm trying to popen a Kivy app bundled using pyinstaller from a Windows service and it fails to open, throwing

OpenGL Version detected : 1.1

Code:

[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "D:\PythonVENV\mist-app\dist\app\kivy\__init__.pyc"
[INFO   ] [Python      ] v3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "D:\PythonVENV\mist-app\dist\app\app.exe"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] No framebuffers extension is supported
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'1.1.0'>
[INFO   ] [GL          ] OpenGL vendor <b'Microsoft Corporation'>
[INFO   ] [GL          ] OpenGL renderer <b'GDI Generic'>
[INFO   ] [GL          ] OpenGL parsed version: 1, 1
[CRITICAL] [GL          ] Minimum required OpenGL version (2.0) NOT found!

OpenGL version detected: 1.1

Version: b'1.1.0'
Vendor: b'Microsoft Corporation'
Renderer: b'GDI Generic'

Try upgrading your graphics drivers and/or your graphics hardware in case of problems.

But the thing is, my GPU runs with open gl 4.6

When I execute it usually :

[INFO   ] [Logger      ] Record log in C:\Users\wasim\.kivy\logs\kivy_20-04-11_61.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.2.0
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "D:\PythonVENV\mist-app\venv\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "D:\PythonVENV\mist-app\venv\Scripts\python.exe"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.6.0 NVIDIA 445.75'>
[INFO   ] [GL          ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO   ] [GL          ] OpenGL renderer <b'GeForce GTX 1060 3GB/PCIe/SSE2'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 6
[INFO   ] [GL          ] Shading version <b'4.60 NVIDIA'>
[INFO   ] [GL          ] Texture max size <32768>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [KivyMD      ] v0.104.0
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [Base        ] Start application main loop

I saw many people complain about it but the thing is, that app runs as expected when running it normally (without the service popening it / standalone).

I saw some issues mentioned to change to angle_sdl2 but it throws another error saying "A valuable windows provider was not found". I found out that it used GL 3.2 instead of 4.6

Turning on to only sdl threw the same error.


Solution

  • I've finally solved it !

    @inclement you were right ! it was indeed running in a different environment and changing the environment only didn't make up for the working.

    the services run in a totally different environment and has restricted access to the logged-in user's desktop interface.

    I tried to explain it in detail here : Pystray icon available when running as a service

    it worked for me !