If you're following along with a Raspberry Pi, Beaglebone or any other supported small linux computer, we'll use a special library called adafruit_blinka (named after Blinka, the CircuitPython mascot) to provide the layer that translates the CircuitPython hardware API to whatever library the Linux board provides. It's CircuitPython, on Pi!

Update your Pi and Python

The latest Raspbian (currently this is `Stretch`) is required for the installation of Adafruit IO + Blinka.

In this page we'll assume you've already gotten your Raspberry Pi up and running and can log into the command line.

Go ahead and ssh into your Raspberry Pi via terminal or a ssh client:

ssh [email protected]

Run the standard updates:

sudo apt-get update

sudo apt-get upgrade

and

sudo pip3 install --upgrade setuptools

Make sure you're using Python 3!

The default python on your computer may not be python 3. Python 2 is officially discontinued and all our libraries are Python 3 only.

We'll be using python3 and pip3 in our commands, use those versions of python and pip to make sure you're using 3 and not 2

Install Python Libraries

Installing Adafruit Blinka Library

Now you're ready to install all the python support

Run the following command to install the Raspberry PI GPIO library:

pip3 install RPI.GPIO

Run the following command to install adafruit_blinka

pip3 install adafruit-blinka

The computer will install a few different libraries such as adafruit-pureio (our ioctl-only i2c library), spidev (for SPI interfacing), Adafruit-GPIO (for detecting your board) and of course adafruit-blinka

Installing Adafruit IO Python Library

We'll also need to install the Adafruit IO Python Client Library to communicate with Adafruit IO.

Run the following command to install the Adafruit IO Client for Python:

pip3 install adafruit-io
If the installation gives you 'insufficient permissions' errors, add 'sudo' before the call to pip3

Downloading Example Code

The example code is contained within the Python IO Client's examples/basics subdirectory.

Navigate to the root directory of your Pi:

Then, download the latest version of the adafruit/io-client-python repository by running:

git clone https://github.com/adafruit/io-client-python.git

Navigate to that folder's example folder for the examples: 

cd io-client-python/examples/basics/

That's it! We're all set up.

Next, let's upload some code and learn how it works.

This guide was first published on Apr 25, 2015. It was last updated on Oct 19, 2023.

This page (Python Setup) was last updated on Nov 10, 2023.

Text editor powered by tinymce.