How to Install Python and Jupyter Notebook onto an Android Device | by Angelica Lo Duca | Towards Data Science

Thanks to the spread of mobile technologies, we are online for almost all the part of the day: while travelling by car or by train, preparing the dinner and even when we go out for a walk.
For who, like me, is always active and multitasking, it may happen that, while sitting at computer, she must leave what she was doing to do something else. This means that the previous task at PC is delayed.
I have found a partial solution to this problem: why not continuing the task on the phone (or tablet), while doing other?
Since my main job deals with coding in Python through Jupyter Notebooks, in this post I explain how to install these two components on Android. This task is very simple, since Android is a unix-based operating system.
First of all, Python must be installed on the phone/tablet. Many Apps are available on Google Play. I suggest to install Pydroid 3 — IDE for Python 3.
The installation process is very simple: it is sufficient to access Google Play, search for the App and click on the Install button.
Now that the App is installed, we can run it. The first time the App is launched, Python is downloaded and installed. After, that, we can select the upper left button to open a menu and select Pip, as shown in the following figure:
Once, clicked on the Pip button, a search box opens. We can type jupyter and check the setting: use prebuilt library repository. We click on Install and the following alert appears:
We can click Get Plugin. The Google Play App opens and asks for the installation of the Pydroid repository plugin.
We click on Install and we wait for the completion. Now we come back to the Pydroid App and Pip installation for jupyter.
Once the installation is complete, we can run the jupyter notebook.
We come back to the Pydroid home page and we select the Terminal from the main menu.
A Terminal opens and we can write the command jupyter notebook. Eventually the notebook starts and the App asks whether we want to open it in the browser or in the Pydroid app.
The final step involves storage. In order to keep synchronised our notebooks among different devices, we should install a shared drive among them. One possible solution could be the usage of Dropbox or Google Drive. In this article we describe how to configure Dropbox, which offers 2 GB of space in the free version. Firstly, I download the Dropbox App for desktop from this link and we install it on the computer. Then we download the same App on the smartphone from Google Play.
Once installed on both the devices, we can synchronise them. For example we can access the dropbox folder on our computer from Terminal and then run the Jupyter notebook. We can create the following hello world notebook and name it Test.ipynb.
print('Hello world!)
Then we must access Test.ipynb from the smartphone. We run Dropbox from the smartphone and wait for synchronisation. Then we hold on Test.ipynb and we access the top right menu and we click Save. We choose the location on the file system.
Now we can run the Jupyter notebook from smartphone through Pydroid and access the folder containing Test.ipynb from the Jupyter file manager. Et voila! We can continue our notebook from the smartphone! Note that our edits will not be synchronised automatically on dropbox. Thus, once completed the code, we need to access the the previous folder from the smartphone file system and share it with dropbox.
In this article, I have illustrated how to install and configure Python and Jupyter onto an Android-based phone. Then, I have illustrated how to synchronise the computer and the smartphone in order to work on the same piece of code.
An alternative solution to the proposed mechanism could be the execution of Python completely online. This can be achieved, for example, through Google Colab. But this is reserved as a future post :)
If you wanted to be updated on my research and other activities, you can follow me on Twitter, Youtube and and Github.