Jupyter on Android phones and tablets

Writing Python on the go is not easy or something you should do often. But if you have a long commute, why not? :)

There are several cool options already, like PyDroid3 (among others) allowing you to have a Python interpreter wherever you go. But what if you want more capabilities, like testing Jupyter notebooks or full control over your installed packages (with pip or conda). Or… What if you just want to mess around with Jupyter on your phone/tablet? Well, the answer is that it is very easy to try it out and see if you like it. Here are the steps.

  1. We will need to install Termux, and you can also get it from the Play Store if you do not use F-Droid

  2. We will also need Termux-Fedora (which I am very proud of, with its 150+ stars on Github). The instructions are in the readme file there. It is very simple nowadays, it only takes a couple of minutes on a relatively modern phone.

  3. Once inside the chroot we need to install Jupyter. On Fedora a simple dnf install python3-notebook -y will do the trick. You don’t want to install Jupyter with pip as a lot of its dependencies will need to be compiled (e.g. with g++). If you use dnf, precompiled binaries will be installed. On a phone/tablet this is a big plus. Another big plus is that dnf also pulls some weak dependencies you will want like pandas, numpy, matplotlib, scipy etc.

  4. When the installation is complete (takes 5-10 minutes, and around 900MB of space) you can run Jupyter with a simple jupyter notebook --allow-root. A link will be provided, copy it to your favorite browser. And that’s it!

8f3f5dc0-ccfd-4d04-a1dc-5d4f555df64e.jpeg

So what can you do with it? Anything basically, from simple stuff to training neural networks with tinygrad or pytorch.

717c9a9d-92fd-4e7c-842f-b852aa538096.jpeg

91714342-d1d6-44af-8138-2921724af34d.jpeg

Alternatives? Well you can use some of the Android apps available but they will always be limited. If you want full possibilities I think this is the way to go. Or, just setup your Vim for Python development and enjoy it that way. I found an excellent guide on how to make Vim more like PyCharm when you can’t use it. It is called VimCharm.

e717083e-e7c6-439d-9007-37ec2f0593f7.jpeg

It is of course great that we have this options, in the first place.

Enjoy! :)

 
7
Kudos
 
7
Kudos

Now read this

Testing PyTorch XLA with Google Colab TPUs

If you are not aware, PyTorch XLA project is an effort to run PyTorch on TPU (Tensor Processing Unit) architecture which offers even higher performance in training Deep Learning models compared to GPU’s. In my previous post I showed you... Continue →