[Note] The story of setting up the SDK for Python of Azure IoT Hub on Linux

Synopsis

Azure IoT Hub, one of the services on Microsoft Azure A story when trying to install an SDK for use from Python 3.x series.

As usual, I started collecting information by googled "azure iot sdk", The following sites are hit.

・ Https://docs.microsoft.com/ja-jp/azure/iot-hub/iot-hub-python-getstarted

According to the above site, as a package that can be installed with pip, The following already exists.

・ Azure-iothub-service-client ・ Azure-iothub-device-client

Enter the following without thinking about anything.

pip install azure-iothub-service-client

However.

Downloading/unpacking azure-iothub-service-client
  Could not find any downloads that satisfy the requirement azure-iothub-service-client
Cleaning up...
No distributions at all found for azure-iothub-service-client
Storing debug log for failure in /root/.pip/pip.log

I spit out an error.

If you take a closer look at the above site ... "Azure-iothub-service-client and azure-iothub-device-client pip packages are only available on Windows OS" There is a statement to that effect. If you use it from Linux, you need to install it by another method.

Clone the package from github and build it.

Clone quickly.

git clone --recursive https://github.com/Azure/azure-iot-sdk-python.git

The files included in the repository as submodules are also needed in the build, so You need to add the --recursive option when cloning.

After cloning, refer to the following ...

・ Https://github.com/Azure/azure-iot-sdk-python/blob/master/doc/python-devbox-setup.md#linux

There is a script that builds and installs, so go there.

cd azure-iot-sdk-python/build_all/linux/

I wanted to build it for Python3.4, so I did the following: If you omit the --python-version and --build-python options, Both seem to be set up / built for 2.7.

sudo ./setup.sh --python-version 3.4
sudo ./build.sh --build-python 3.4

If build.sh is successful, you will be able to import under Python 3.4 environment.

That's all for the memorandum.

Recommended Posts

[Note] The story of setting up the SDK for Python of Azure IoT Hub on Linux
How to change the log level of Azure SDK for Python
The story of low learning costs for Python
Upgrade the Azure Machine Learning SDK for Python
Image processing? The story of starting Python for
Put the latest version of Python on linux (Debian) on Chromebook
Run AWS IoT Device SDK for Python on Raspberry Pi
The story of how the Python bottle worked on Sakura Internet
Setting up OpenSSH on Arch Linux
Pub/sub on paho on Azure IoT Hub
The story of making a standard driver for db with python.
The story of releasing a Python text check tool on GitHub x CircleCI for the first time
boto3 (AWS SDK for Python) Note
python note: map -do the same for each element of the list
The story of running the asp.net core 3.1 app on arm64 version Amazon Linux 2
The story of making Python an exe
Notes for setting up pydicom on macOS
The story of manipulating python global variables
Pandas of the beginner, by the beginner, for the beginner [Python]
The story of blackjack A processing (python)
Python Note: The secret role of commas
The story of switching the Azure App Service web system from Windows to Linux
[Note] The solution for Python on MacOSX where import hashlib causes an error
[Linux] Review of commands for deploying on AWS
[Note] Export the html of the site with python.
Beware of disable_existing_loggers when setting up Python logging
[2020July] Check the UDID of the iPad on Linux
[Note] Deploying Azure Functions for the first time
Get note information using Evernote SDK for Python 3
A note about the python version of python virtualenv
The story of reading HSPICE data in Python
[Note] About the role of underscore "_" in Python
Code for checking the operation of Python Matplotlib
At the time of python update on ubuntu
Call Polly from the AWS SDK for Python
Basic story of inheritance in Python (for beginners)
The story of Python without increment and decrement operators.
I tried Python on Mac for the first time.
The story of replacing Nvidia GTX 1650 with Linux Mint 20.1.
The story of building the fastest Linux environment in the world
[AWS IoT] Register things in AWS IoT using the AWS IoT Python SDK
Pub/sub (CA certificate) with paho on Azure IoT Hub
Fleet provisioning with AWS IoT SDK for Python v2
Create a QR code for the URL on Linux
I tried python on heroku for the first time
The story of FileNotFound in Python open () mode ='w'
Information for controlling the motor with Python on RaspberryPi
Support for Python 2.7 runtime on AWS Lambda (as of 2020.1)
Make up for the lack of Maya Node reference
[Linux] Basics of authority setting by chmod for beginners
Compile and install MySQL-python for python2.7 on amazon linux
A note on speeding up Python code with Numba
About the --enable-shared option when building Python on Linux
Stray build of Python 3 on Sakura's rental server (Note)
Notes on writing config files for Python Note: configparser
The story of automatic language conversion of TypeScript / JavaScript / Python
Announcing the availability of Java 11 LTS on Amazon Linux 2
Python Note: The mystery of assigning a variable to a variable