Python 2.7.13 running on Android

I stumbled across a very interesting project called LBRY a while back, which I can describe as bitcoin meets bittorrent, Youtube and Soundcloud and and they all have a baby. The app includes a daemon developed in Python which is used to communicate with the LBRY network, and the goal was to get this running on Android one way or another. Prior to this, I had absolutely no idea there was a way to actually get Python on Android. I mean, it was theoretically possible since Android is based on Linux, but I had just never come across anything related to that.

Then I found out about Kivy, and the python for android (p4a) project. P4A makes use of a mechanism called recipes which define how certain Python modules or components should be built for a platform. There was a joint effort to get the daemon to compile and actually run on Android, which was eventually successful, but the Python version for the current p4a master branch is 2.7.2. I wasn’t exactly satisfied with this, so I went down the rabbit hole of getting Python 2.7.13 up and running. This took quite some time and effort, but I managed to get it to work. I found it to be quite frustrating at times, but it was also very exciting and I had a feeling of satisfaction after I had finished.

Funny story, after figuring it all out, I discovered there were pull requests created in Github for the p4a project related to building with Python version 2.7.11. If I had found them earlier, my life would have been a whole lot easier! Either way, it was a good learning experience and I’m glad to say it works pretty well.

You can find the LBRY Android project on Github if you’re interested in the recipes for building and running Python 2.7.13.

Building Visual Studio Code for the Raspberry Pi 3

If you’d rather prefer to use Visual Studio Code for C# development instead of MonoDevelop, you can build Microsoft’s own Visual Studio Code from the source repository. I’ve used Visual Studio Code on Ubuntu and it’s actually a pretty neat tool for developing on Linux. It supports over 30 languages including C#, C++, Python, Java and more, so even if you’re not writing C# code, it’s still a useful tool.

Prerequisites for the build on Linux include Python 2.7, make and libx11-dev which should already be installed on your Pi if you started of with a Raspbian Jessie image. Also, if git has not been installed yet, run sudo apt-get install git. Nodejs and npm also need to be installed, as they will be used by the build script to retrieve some required packages. A recent version of nodejs has to be downloaded since the package version in the repository is not adequate.

Install required dependencies for running Visual Studio Code.

Let’s clone the repository and start the build process.

If you get an error like so:

edit npm-shrinkwrap.json and delete the following lines.

Once the build is completed, you can run:

The script will download a few more required files and perform a few initialisation steps before the IDE launches. The editor performance was very poor when I ran it using X11 forwarding however. Perhaps, it works better if running within a native X11 display.

Visual Studio Code running on the Raspberry Pi 3 using X11 forwarding

Visual Studio Code running on the Raspberry Pi 3 using X11 forwarding