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 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