Python Multiprocessing Compatibility in Android

250 views
Skip to first unread message

John Jameson

unread,
Jan 20, 2022, 12:57:16 AM1/20/22
to Kivy users support
Might anyone know if multiprocessing is compatible with Python on Android, i.e. when using buildozer, etc.?

Thank you,
John

Robert

unread,
Jan 20, 2022, 2:14:28 AM1/20/22
to Kivy users support
In the sense of portable Python, effectively not. In theory you can use subprocess(), but you'll need an ARM executable for whatever you want to run and you'll have to build that yourself.  And of course there is no bash shell, though there is a minimal shell. There is no PATH so your executable must be local. Generally Android does not like app starting executables so there may a long term supportability issue (or not?).  I don't know of anybody using this, but last time I tried to run a shell command it worked.

The Android equivalent is a service, which in this context runs a Python script with a new interpreter. But this is simplistic compared to multiprocessing. https://github.com/Android-for-Python/Android-for-Python-Users#android-service 

With a service the multi core performance is there but not that great, see the experiment result at the end of this page https://github.com/Android-for-Python/Multi-Service-Example#multi-service-example

Robert

unread,
Jan 20, 2022, 2:25:33 AM1/20/22
to Kivy users support
Oops, there is a PATH you just can't save to any of the locations.
Reply all
Reply to author
Forward
0 new messages