How to run Jupyter Notebook offline in Android

Jupyter Notebooks are essential for Machine Learning engineers and Data Science practitioners. Here I am showing how to run Jupyter Notebook with Python fully offline inside of your Android smartphone or tablet.


Why to run Jupyter Notebook offline and in your Android if you can run it online (for example via free Azure Notebooks) or offline in PC (for example via Anaconda installation)? The answer is simple: sometimes you are in airplane without Internet and sometimes you have weak or unreliable reception of cellular signal and then having offline ability is essential. Also Android devices are much smaller than regular notebooks like Windows PC and MacBooks so much more mobile: if you have Jupyter in your Android you can use it for example while commuting or where signal reception is unreliable. Finally you achieve total privacy by using Jupyter in your Android as it’s not visible for people online.

Basically to get Jupyter Notebook running off-line in Android. you need to get Python IDE (integrated development environment) app for Android and this app must support loading of Jupyter ( IPython ) libraries as well es various Python libraries like Numpy and Matplotlib for mathematics and scikit-learn for Machine Learning. To get such app you need to download PyDroid app:

Next I will show how to configure Jupyter Notebook in that app and how to run it inside of Android offline. Basically everything works offline inside of Android, it is not just front-end to some Jupyter Notebooks online but full Python 3.x and many libraries both for Jupyter and other purposes, including Machine Learning.

Inside of app select from menu “pip” which is Python’s installation program (PIP = Python Installs Packages), go to Install tab, tap on Install button near Jupyter and then you will see how Jupyter is being installed:


Once the Jupyter is installed you can see it in libraries tab:


As you can see above the usage of pip inside of PyDroid app is simplified as you don’t have to type full phrase but tapping on button suffices and author of the app provides these packages compiled for Android from his servers.

In similar way you should install also other Python packages related to machine learning like: Numpy, Matplotlib and scikit-learn!

Next it’s time to start Jupyter Notebook which essentially is a web server that allows. you to edit and run interactive programs with output right on the web pages.

Default way to running Jupyter Notebook is to use tokens to enter via web browser but this scenario is cumbersome in Android. Tokens are designed to provide security – to ensure that if you are on network then nobody can enter your web server with Jupyter Notebook but you. But in case of Android that is running offline there is no such danger.

To prevent Jupyter Notebook from using annoying tokens, inside of PyDroid app, from menu, open terminal and write:

       jupyter notebook password

Then you should enter password that you want to use in your web browser.

Then you are ready to start Jupyter Notebook web server, to do this just open terminal and write:

       jupyter notebook

You can stop the web server by closing the terminal window or by pressing “control-C” (which is achieved in my Android device by “Volume Down”+C but it may vary).

Once web server with Jupyter is running you can see it in terminal window:


Now that Jupyter Notebook’s server is running you are ready to open it with web browser of your choice (I use here Android’s standard web browser Chrome), by opening the following URL: http://localhost:8888 ! Before you open web browser however, I suggest creating directory with file explorer, in my case I called it “/Py” (like Python) but feel free to name it differently and to place it elsewhere.

And now you are ready start using Jupyter Notebook offline in your Android! In your web browser after opening http://localhost:8888 the password will be requested (that you specified in terminal above) but this password will be saved by browser so you don’t have to enter it every time.

Here is how it looks (note that everything works, here I am just drawing a function plot):



The end! You see? You can run full Jupyter Notebook (with many Python and Machine Learning things) inside of your Android! No need for PC and no need for Internet.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s