Python on a Raspberry Pi using VS Code

Jim Bennett | Apr 2, 2019

I’ve recently been playing with a Raspberry Pi with the aim of learning Python. These are great little computers and have been an amazing success, selling 19 million as of March 2018, and kids everywhere are using them to learn to code with Scratch and Python.

The IDE for Python that is shipped by default is IDLE. This is a great IDE that comes as part of the standard Python install - it has an interactive shell and file editor, debugger and everything you need. It’s good enough, but not quite on par with the world class editor that is Visual Studio Code.

Currently there aren’t any official builds for VS Code for ARM processors, although there is a request for it on GitHub. Please head to this link and upvote it:

There is however a community build, courtesy of Jay Rodgers. You can find the installation instructions on, but I’ve found that these instructions don’t work due to an issue with the GPG key. There is a workaround!

To get the GPG key installed, launch a terminal and enter the following commands.

sudo apt-key add gpgkey

Once done, you can run the installer script. Enter sudo mode using:

sudo -s

Then run the installer:

. <( wget -O - )

This will install a non-VS branded version of code. The lack of Visual Studio branding is intentional - the code is open source, but the logos are copyright Microsoft. This means that a community build can’t use these icons. You can launch this from the menu, Raspberry->Programming->Code - OSS (Headmelted).

There is an issue with v1.32. It will launch, but not run properly. The fix is to rollback to an earlier version, v1.29. To do this, run this command:

apt-get install code-oss=1.29.0-1539702286

This rolls back to an earlier version. This does mean if you run apt-get update at a later date the latest version will be installed, breaking it again. To stop this happening, you can lock the version using:

apt-mark hold code-oss

Once a fix has been released, you can remove the version lock with:

apt-mark unhold code-oss

Once you launch code you will be able to install the extensions you need. In my case, I wanted the Python extension.

Quick restart later and I’m up and running with a full Python environment inside VS Code, with a full debugger and all the goodies I could ever want!