Is there a way to set up python 2.7.x + matplotlib on an android tablet so that you can run simple standard python code? I would like to be able to run the same scripts I run on my Linux desktop. This is just for my own use and I don't need to distribute the code to anyone else.
As a concrete example, is it possible to run this script?
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y)
Python can run on Android through various apps from the play store library. This tutorial will explain how to run python on Android using Pydroid 3 – IDE for Python 3 application. Features : Offline Python 3.7 interpreter: no Internet is required to run Python programs.
Chaquopy is a plugin for Android Studio's Gradle-based build system. Chaquopy enables you to freely intermix Java and Python in your app, using whichever language is best for your needs: With the Python API , you can write an app partly or entirely in Python.
If you want to run Python on mobile, one of the easiest options is simply to download an IDE on your chosen platform. There is no need to download a separate interpreter, you can simply download the app and start typing and running your Python code.
Matplotlib is a cross-platform, data visualization and graphical plotting library for Python and its numerical extension NumPy. As such, it offers a viable open source alternative to MATLAB. Developers can also use matplotlib's APIs (Application Programming Interfaces) to embed plots in GUI applications.
Is it easy, no.
Can it be done? Yes. I believe a skilled Python / Android developer could do it in 2 to 8 hours of effort.. It's a rare and complex request.
Why do I think it can be done? This sample: http://matplotlib.org/examples/pylab_examples/webapp_demo.html
Using a different library, and not abstracted for data without live hardware, this sample shows me that SL4A can do web-based graphics: http://www.smartphonedaq.com/android-python-ecg.page
Now, if you were talking native GUI graphics in Android - then I'm focused way too much on the web methods of publishing with SL4A ;)
Pydroid is great for Matplotlib on Android, supports Numpy and many other libraries:
Pydroid for Python 2.7
Pydroid 3 for Python 3.6
There is an app called Gnuroot that allows you to run a kind-of chroot (proot), where you can install a linux distro such as debian, archlinux...
For the gui, there is the option to run a vncserver for an X server and use some android vnc client app to show the screen.
I use the non-gui version of gnuroot and it works well. I now have a command line debian wheezy on android lollipop arm. One minor thing i miss, is armhf (hardware floating point which my nexus7's processor can do) support instead of armel (software floating point).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With