KivyPie and python3

365 views
Skip to first unread message

mwwn

unread,
Jan 15, 2016, 2:44:49 AM1/15/16
to KivyPie
Hi,

is there an easy way to use python3 and kivy on KivyPie? It doesn't seem to be installed by default and the obvious ways (apt get install python3-kivy) lead to the message

[INFO   ] Kivy v1.8.0
[INFO   ] [Logger      ] Record log in /home/sysop/.kivy/logs/kivy_16-01-15_6.txt
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif (img_pygame, img_pil ignored)
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600s
[INFO   ] [Factory     ] 157 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG  ] [Window      ] Ignored <egl_rpi> (import error)
[DEBUG  ] [Window      ] Ignored <pygame> (import error)
[WARNING] [WinPygame   ] SDL wrapper failed to import!
[DEBUG  ] [Window      ] Ignored <sdl> (import error)
[DEBUG  ] [Window      ] Ignored <x11> (import error)
[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
[CRITICAL] [App         ] Unable to get a Window, abort.

batr...@gmail.com

unread,
May 9, 2016, 6:40:19 PM5/9/16
to KivyPie, marvin....@googlemail.com
Hi mwwn,

Yes, I wanted to run python3 with kivy too.

Here's what I did on the kivypie distro:

1. sudo apt-get update
2. vi /etc/fstab and change the /tmp size from 16m to 200m (otherwise you won't be able to build cython, etc.)
3. sudo apt-get install python3-pip 
4. sudo pip3 install cython (took a while to build!)

You should now see packages in /usr/local/lib/python3.4/dist-packages and you can now run the examples using python3.

Thanks,
-Raj

Albert

unread,
May 10, 2016, 7:06:31 AM5/10/16
to KivyPie, batr...@gmail.com
Thanks for the update, Raj,

I'll be releasing a new version built on Python 3 soonish !

Albert

batr...@gmail.com

unread,
May 10, 2016, 4:03:20 PM5/10/16
to KivyPie, batr...@gmail.com
Thanks, Albert I look forward to it! 

BTW, small fix in my response - in step 5). It should be pip3 (not pip). I.e. sudo pip3 install git+https://github.com/kivy/kivy.git@master

-Raj

deve...@appsdesignlab.com

unread,
Jun 5, 2016, 12:17:26 PM6/5/16
to KivyPie, marvin....@googlemail.com
Hi I'm trying to upgrade Kivy to use Python3 ...

Followed the instructions as stated by Raj in this thread... it worked fine... but it yielded no difference...

$ kivy

Python 2.7.9 (default, Mar  8 2015, 00:52:26) 

[GCC 4.9.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> 


Kivy still uses Python 2.7.9

r...@kaos.stanford.edu

unread,
Jun 6, 2016, 2:31:40 PM6/6/16
to KivyPie, marvin....@googlemail.com, deve...@appsdesignlab.com
Hmm, I never launched kivy that way (I usually just type python3). I see that kivy is a symbolic link to /usr/bin/python2.7.

You could do a similar thing by creating a kivy3 link by entering the command: sudo ln -s /usr/bin/python3 /usr/bin/kivy3

You can then launch it by typing kivy3 to be consistent.

Thanks,
-Raj

Albert

unread,
Jun 6, 2016, 3:03:54 PM6/6/16
to KivyPie, r...@kaos.stanford.edu
Thanks guys. I have built a new Kivypie image with python3.
I haven't had the time to even test it, if you could give it a try and let me know that'd be tops!
Should boot on the PI3 too.


Albert

r...@kaos.stanford.edu

unread,
Jun 7, 2016, 12:20:27 PM6/7/16
to KivyPie, r...@kaos.stanford.edu
Hi Albert,

When I launch python3 or kivy at the command line, then do an import kivy, I get an ImportError: No module named 'kivy'


Thanks,
-Raj

Albert

unread,
Jun 7, 2016, 7:19:40 PM6/7/16
to KivyPie, r...@kaos.stanford.edu
Thanks Raj! sorry about that. Wrong compilation method :)
Should be working on this new release:


kivy loads python3, python loads python2.

Albert

dr.vika...@gmail.com

unread,
Jul 15, 2016, 8:53:35 PM7/15/16
to KivyPie, r...@kaos.stanford.edu
Hi Albert,

I downloaded the latest release (0.9b) and it works fine on Raspberry Pi 3 & official display.  But I have some older apps that work with python2.  What is the easiest way to revert back to have the default be python 2 instead of python3?

Thanks,

Vikas

Albert

unread,
Jul 19, 2016, 4:38:42 AM7/19/16
to KivyPie, dr.vika...@gmail.com
Hi Vikas,

On top of my head... sudo ln -sfv /usr/bin/kivy /usr/bin/python2.7

Or... sudo ln -sfv /usr/bin/kivy2 /usr/bin/python2.7, and change your main kivy app's shebang.

But I suspect some things will go wrong at runtime...

Ideally, Kivy debian packages should be produced from Kivypie builds, I think.
This would make it more practical, and portable across other RPi distros as well.

Albert

r...@kaos.stanford.edu

unread,
Jul 19, 2016, 6:23:34 PM7/19/16
to KivyPie, dr.vika...@gmail.com
Wouldn't 'python mykivyprogram.py' be sufficient to run under 2.7 and 'python3 mykivyprogram.py' for 3.x?

-Raj

Albert

unread,
Jul 20, 2016, 4:09:59 AM7/20/16
to KivyPie, r...@kaos.stanford.edu
On kivypie 0.9b, kivy command points python3, python points to python 2 by default.
So yeah, depends on how you launch your apps.

Does it actually run kivy apps built for python2 with no issues?

Albert
Reply all
Reply to author
Forward
0 new messages