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.
We will need to install Termux, and you can also get it from the Play Store if you do not use F-Droid
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.
Once inside the chroot we need to install Jupyter. On Fedora a simple
dnf install python3-notebook -ywill 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
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!
So what can you do with it? Anything basically, from simple stuff to training neural networks with tinygrad or pytorch.
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.
It is of course great that we have this options, in the first place.