1

good day.

I had an apps which developed using Pycharm, it consist of Kivy UI. While I running the apps using Pycharm with simulate on my Raspberry Pi, it is working fine and very smooth.

But after that when I deployed it to Raspberry Pi and run the apps in terminal using sudo python commnad, the apps is lagging and unstable. Can anyone tell me what's the thing that i should check on?

1

Question

How come my PyCharm/Kivy app runs so slowly in Rpi Raspbain?

How to fix it?

Answer

Reason

Well, There are many reasons that your PyCharm/Kivy app is slow. The same reasons apply to me running Intel PC Win10 Chrome faster than Rpi3B+ Raspbian Chromium.

Two basic problematic areas are:

  1. Hardware difference - PC has more "cores".

  2. Software difference - Win Chrome has less "layers".

Solution

I have been complaining since Rpi1A that Chromium is slow. Now I am happy that Rpi3B Chromium runs many times faster. I heard that the Rpi software guys have been working very hard, but of course the hardware upgrades (more, faster cores, etc) also help.

In other words, time heals everything - you problem will disappear as soon as Rpi4++ and Raspbian 10++ arrive.

References

Kivy - Wikipedia

Kivy is a free and open source Python library for developing mobile apps and other multitouch application software with a natural user interface (NUI). It is distributed under the terms of the MIT License, and can run on Android, iOS, Linux, OS X, and Windows.

Kivy is the main framework developed by the Kivy organization, alongside Python for Android, Kivy iOS, and several other libraries meant to be used on all platforms. In 2012, Kivy got a $5000 grant from the Python Software Foundation for porting it to Python 3.3. Kivy also supports the Raspberry Pi which was funded through Bountysource.

The framework contains all the elements for building an application such as:

extensive input support for mouse, keyboard, TUIO, and OS-specific multitouch events,

a graphic library using only OpenGL ES 2, and based on Vertex Buffer Object and shaders,

a wide range of widgets that support multitouch,

an intermediate language (Kv)[7] used to easily design custom widgets.

Kivy is the evolution of the PyMT project, and is recommended for new projects.

Kv language

The Kivy language (Kv) is a language dedicated to describing user interface and interactions. As with other user interface markup languages, it is possible to easily create a whole UI and attach interaction. For example, to create a Loading dialog that includes a file browser, and a Cancel / Load button, one could first create the base widget in Python, and then construct the UI in Kv, ...

  • Hi, I do know that PC is much powerful than Raspberry PI. but i thought that if I am running the Pycharm with SSH, the apps is using Raspberry Processor because the interpreter is pointing to Raspberry Pi and also the display is showing is Raspberry Pi screen. – alpha91 May 8 at 3:14
  • Ah. I am sorry. I might have misunderstood your situation. I only know a couple of examples perhaps not applicable to your situation. TensorFlow runs fast in PC Windows, because it make use of Nvidia GPU. When it runs in Rpi, it cannot use Rpi GPU, because of license problem. So all GUI is a bottleneck. Win10 IoT runs fast in WinPC, but need fiddling to run in Rpi, even cutting almost ALL GUI things. So if your project involves GUI, then there is a problem. I confess again I know too little about Kv to judge anything. Judging Kv's ridiculously small funding, I don't expect much, :( – tlfong01 May 8 at 3:43
  • i see... alright. thank you very much for your info. I will try to figure something out then. thanks and have a nice day. – alpha91 May 8 at 5:15
  • You are welcome. Good luck. – tlfong01 May 8 at 6:00
1

Sorry, the lagging issue just resolved.

The applications is design with Python3 features. The lagging issue is due to running with Python 2 interpreter (default interpreter), launching command as below:

python script.py

It is my mistake that actually I should run my application with Python3 with the command below:

python3 script.py

After launching the application with Python3, the application run smoothly and most of the bugs is resolved. Hope this info helps other developer as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.