PIP install for Python SDK now works on Raspberry Pi!

The Azure IoT product group has been busy making improvements to our Python SDK for Azure IoTHub.  The biggest improvement is that they’ve put a fix in for the infamous “libboost” issue that prevented the PIP package from working on the Raspberry Pi.   Previously, if you wanted to use the Python SDK on a Raspberry Pi, you had to manually build from the source, a time and resource intensive process.

If you aren’t familiar with it, Boost allows you to invoke C code from Python (the Python SDK is built on the C SDK).

Base SDK install/usage

For now, they’ve updated the SDK to link against the current version of libboost that works on the latest version or Raspbian stretch (1.62.0).  Future improvements may remove this requirement, but for now, you need to make sure that libboost is installed on the Pi (it’s not, by default).  So use the following two statements to get the SDK installed and setup:

sudo apt-get install libboost-python1.62.0

pip install azure-iothub-device-client
After that, in your code, you can ‘import iothub_client’ and go to town!

IoT Edge/Docker

As a bonus (for writing IoT Edge modules for the RPI), i did a quick test to confirm that all of this works in a docker container too.  There will be official guidance and tooling from the IoT product group in the future, but for now, a simple Dockerfile like this works for creating a docker image that contains a Python app that uses our Python SDK…

FROM python:2.7.15-stretch

WORKDIR /usr/src/app

RUN apt-get update && apt-get install libboost-python1.62.0

COPY requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "-u", "./app.py" ]

the requirements.txt file, just contains one line:   “azure-iothub-device-client”

next up, I’ll be testing with a full blown IoT Edge module on the raspberry pi, and I’ll post the results soon


Azure IoTHub Auto-scaling

For my inaugural post, I figured, just to have it in one place, I’d revisit something I posted a few months ago on the Azure.com IoT blog.  In fact, doing this is one of the things that prompted me to start this one…   Anyway, a frequent requested feature for Azure IoT Hub is the ability to auto-scale the IoT Hub when you approach your message limit for the day.   It’s a feature that is definitely on our roadmap, but IoT Hub doesn’t natively support it today.   This blog post on azure.com and accompanying sample show you an example solution of how you can do it today.

Getting started!

Hi!    At the prompting of a few of my compatriots, I’ve decided to (finally) start a blog.  This blog will, mostly,  focus on Internet of Things solutions with Microsoft Azure and it’s related technologies, but as with the randomness of topics inside my head, may wander from time to time!  If nothing else, it gives me a place to collect all my random tips and tricks so I can stop trying to remember exactly where it was that I saved that little nugget of random information that helps me get through the day!

Hope you enjoy it!   Check out the “About Me” page for a little background.