analitics

Pages

Showing posts with label kivy. Show all posts
Showing posts with label kivy. Show all posts

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.

Saturday, November 11, 2017

Using kivy python module with PyCharm IDE.

First, you need to download the last version of PyCharm IDE.
My PyCharm IDE put the python version 3 into a folder named Miniconda3.
I use the command shell to go to Scripts and I used pip to install the kivy python module, see:
Scripts>pip install kivy
Collecting kivy
  Downloading Kivy-1.10.0-cp36-cp36m-win_amd64.whl (3.5MB)
    100% |████████████████████████████████| 3.5MB 380kB/s
Collecting pygments (from kivy)
  Downloading Pygments-2.2.0-py2.py3-none-any.whl (841kB)
    100% |████████████████████████████████| 849kB 1.3MB/s
Collecting Kivy-Garden>=0.1.4 (from kivy)
  Downloading kivy-garden-0.1.4.tar.gz
Collecting docutils (from kivy)
  Downloading docutils-0.14-py3-none-any.whl (543kB)
    100% |████████████████████████████████| 552kB 1.8MB/s
Requirement already satisfied: requests 
...
Building wheels for collected packages: Kivy-Garden
...
Successfully built Kivy-Garden
Installing collected packages: pygments, Kivy-Garden, docutils, kivy
Successfully installed Kivy-Garden-0.1.4 docutils-0.14 kivy-1.10.0 pygments-2.2.0
I got one error about SDL and I put the SDL 2.0 into my windows system 32 folders.
The next step is to try to use this steps from the official website into the Scripts folder from Miniconda3.
python -m pip install --upgrade pip wheel setuptools
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy.deps.gstreamer
python -m pip install kivy.deps.angle
python -m pip install kivy
I make one project into my PyCharm editor and I use the default script:
from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
    def build(self):
        return Button(text='Hello World')

TestApp().run()
The result can be see into the next image:

Thursday, January 26, 2017

The kivy pyhon module for android.

First you need to install kivy python module.
The kivy python module
C:\>cd Python27

C:\Python27>cd Scripts

C:\Python27\Scripts>pip install kivy
Collecting kivy
Downloading Kivy-1.9.1-cp27-none-win32.whl (7.4MB)
100% |################################| 7.4MB 50kB/s
Collecting Kivy-Garden>=0.1.4 (from kivy)
Downloading kivy-garden-0.1.4.tar.gz
Requirement already satisfied: requests in c:\python27\lib\site-packages (from Kivy-Garden>=0.1.4->kivy)
Installing collected packages: Kivy-Garden, kivy
Running setup.py install for Kivy-Garden ... done
Successfully installed Kivy-Garden-0.1.4 kivy-1.9.1

Use this to add new pthon modules:
python -m pip install --upgrade docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew kivy.deps.gstreamer --extra-index-url https://kivy.org/downloads/packages/simple/
If the python kivy.deps.gstreamer don't working then is not problem will try without this python module.
To see outdated python modules , use this commnds:
python -m pip install --upgrade pip wheel setuptools
pip list outdated
Let's upgrade all of python modules with this:
pip freeze > requirements.txt && pip install --upgrade -r requirements.txt && del requirements.txt
Another way to install this python module can be found here.
The demo can be star with this comman line:
C:\Python27>python share\kivy-examples\demo\showcase\main.py
You can also test one simple python script:
from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
def build(self):
return Button(text='Hello World')

TestApp().run()

To use with android operating system then test Buildozer.
This tool supports packaging for Android via the python-for-android project, and for iOS via the kivy-ios project. Support for other operating systems is intended in the future.