analitics

Pages

Tuesday, April 30, 2019

Python 3.7.3 : Fix kivy python module installation.

Kivy is a multi-platform GUI development library for Python, running on Windows, Mac, Linux, Android, and iOS.
Today I tested kivy python module with python version 3.7.3 and I got some errors but I fixed.
I started with the default installation using the pip tool.
C:\Python373>cd Scripts
C:\Python373\Scripts>pip install kivy
...
Installing collected packages: docutils, pygments, Kivy-Garden, kivy
...
Successfully installed kivy-1.10.1
I used a default script to test the kivy python module.
When I tested I got these errors:
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Python373\lib\site-packages\kivy\core\__init__.py", line 59, in core_
select_lib
    fromlist=[modulename], level=0)
  File "C:\Python373\lib\site-packages\kivy\core\window\window_sdl2.py", line 26
, in 
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage
...
[CRITICAL] [App         ] Unable to get a Window, abort.
Iinstall the kivy.deps.sdl2:
C:\Python373>cd Scripts
C:\Python373\Scripts>pip install kivy.deps.sdl2
Collecting kivy.deps.sdl2
  Downloading https://files.pythonhosted.org/packages/93/84/a0dc274d993db6f9ebdf
41eb4d55b032de005dbf47e4d54602cf83708b08/kivy.deps.sdl2-0.1.18-cp37-cp37m-win_am
d64.whl (2.5MB)
     |████████████████████████████████| 2.5MB 726kB/s
Installing collected packages: kivy.deps.sdl2
Successfully installed kivy.deps.sdl2-0.1.18
When I tested again, I got another error:
[CRITICAL] [App         ] Unable to get a Window, abort.
I try to see if the install of these python modules are right:
C:\Python373>cd Scripts
C:\Python373\Scripts>pip install pypiwin32
Requirement already satisfied: pypiwin32 in c:\python373\lib\site-packages (223)
Requirement already satisfied: pywin32>=223 in c:\python373\lib\site-packages 
(from pypiwin32) (224)
C:\Python373\Scripts>pip install kivy.deps.glew
Collecting kivy.deps.glew
...
Now the kivy works well:
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC
v.1916 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif
 (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used 
[INFO   ] [GL          ] OpenGL version 
[INFO   ] [GL          ] OpenGL vendor 
[INFO   ] [GL          ] OpenGL renderer 
[INFO   ] [GL          ] OpenGL parsed version: 4, 6
[INFO   ] [GL          ] Shading version 
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [Base        ] Leaving application in progress...
If you search on web you will se this is a common error and some users use this solution:
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2
python -m pip install kivy.deps.glew
python -m pip install kivy.deps.gstreamer
Hope this help you with python programming and kivy interface.