Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems running tutorial on Ubuntu 18.04 #11406

Closed
mattjhayes opened this issue Jul 9, 2018 · 4 comments
Closed

Problems running tutorial on Ubuntu 18.04 #11406

mattjhayes opened this issue Jul 9, 2018 · 4 comments

Comments

@mattjhayes
Copy link

mattjhayes commented Jul 9, 2018

Thanks for IoT Hub tutorial (https://docs.microsoft.com/en-us/azure/iot-hub/quickstart-send-telemetry-python). There seem to be some issues running it on Ubuntu:

  1. libboost error:
ImportError: libboost_python-py27.so.1.58.0: cannot open shared object file: No such file or directory

Workaround was to link to version library that I did have:

sudo su
cd /usr/lib/x86_64-linux-gnu
ln -s libboost_python-py27.so.1.65.1 libboost_python-py27.so.1.58.0
  1. Error with cURL:
ImportError: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found

Workaround:

sudo apt install libcurl3 python-pip
  1. I can't find iothub-explorer. Is this a separate install?

Thanks


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@asergaz
Copy link
Contributor

asergaz commented Jul 9, 2018

@mattjhayes thank you for your feedback! Did you try also the suggestions from Zoltan here. It looks like the same issue as yours.

I can't find iothub-explorer. Is this a separate install?

What is the result after running npm install -g iothub-explorer ?

Thank you.

@mattjhayes
Copy link
Author

I replicated by spinning up a new Ubuntu 18.04 VM.

Start by ensuring Ubuntu 18.04 system up-to-date

sudo apt-get update
sudo apt-get upgrade

Download and unzip tutorial samples:

wget https://github.com/Azure-Samples/azure-iot-samples-python/archive/master.zip
unzip master.zip

Zoltan recommendation to upgrade pip setuptools:

sudo pip install -U pip setuptools

Install the pip package as specified by tutorial:

pip install azure-iothub-device-client

Received an error:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/iothub_client'
Consider using the `--user` option or check the permissions.

Retry with --user option:

pip install azure-iothub-device-client --user

Set up and run simulated device:

cd azure-iot-samples-python-master/iot-hub/Quickstarts/simulated-device
vi SimulatedDevice.py
#<inserted connection string>
python SimulatedDevice.py

Error:

Traceback (most recent call last):
  File "SimulatedDevice.py", line 11, in <module>
    import iothub_client
  File "/home/bob/.local/lib/python2.7/site-packages/iothub_client/__init__.py", line 1, in <module>
    from .iothub_client import *
ImportError: libboost_python-py27.so.1.58.0: cannot open shared object file: No such file or directory

Note, I also tried 'sudo pip install azure-iothub-device-client' but didn't fix issue
Try extra Zoltan recommendations:

sudo apt-get install libboost1.58-all

Error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libboost1.58-all
E: Couldn't find any package by glob 'libboost1.58-all'
E: Couldn't find any package by regex 'libboost1.58-all'

Try this as well, from Zoltan:

sudo apt-get install libboost-all-dev

This downloaded and installed a lot, but didn't fix issue. Still same error when trying to run SimulatedDevice.py

python SimulatedDevice.py 
Traceback (most recent call last):
  File "SimulatedDevice.py", line 11, in <module>
    import iothub_client
  File "/home/bob/.local/lib/python2.7/site-packages/iothub_client/__init__.py", line 1, in <module>
    from .iothub_client import *
ImportError: libboost_python-py27.so.1.58.0: cannot open shared object file: No such file or directory

Try bogan fix that worked previously:

sudo su
cd /usr/lib/x86_64-linux-gnu
ln -s libboost_python-py27.so.1.65.1 libboost_python-py27.so.1.58.0

Now have new error:

python SimulatedDevice.py 
Traceback (most recent call last):
  File "SimulatedDevice.py", line 11, in <module>
    import iothub_client
  File "/home/bob/.local/lib/python2.7/site-packages/iothub_client/__init__.py", line 1, in <module>
    from .iothub_client import *
ImportError: libcurl.so.4: cannot open shared object file: No such file or directory

Install libcurl3:

sudo apt install libcurl3

Run SimulatedDevice.py and it runs (although with errors):

python SimulatedDevice.py 
IoT Hub Quickstart #1 - Simulated device
Press Ctrl-C to exit
Error: Time:Wed Jul 11 22:37:45 2018 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core_ll.c Func:IoTHubClientCore_LL_CreateFromConnectionString Line:892 iotHubName is not found
Error: Time:Wed Jul 11 22:37:45 2018 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core.c Func:create_iothub_instance Line:928 Failure creating iothub handle
IoT Hub device sending periodic messages, press Ctrl-C to exit
Sending message: {"temperature": 31.36,"humidity": 60.62}
IoT Hub responded to message with status: OK
Sending message: {"temperature": 31.00,"humidity": 78.80}
IoT Hub responded to message with status: OK
Sending message: {"temperature": 27.33,"humidity": 78.68}
IoT Hub responded to message with status: OK

messages appear to be being received by Azure IoT Hub, despite the error...

Moving onto the third issue.
My apologies, I had previously missed bit about installing node (suggest moving it to later in the tutorial where it is needed).

sudo apt install nodejs
sudo apt install npm

Tried installing iothub-explorer

npm install -g iothub-explorer

Errored out because of lack of privileges. Lets try that again:

sudo npm install -g iothub-explorer

Run iothub-explorer:

iothub-explorer monitor-events <HUB_NAME> --login <SERVICE_CONNECTION_STRING>

That didn't work. After mucking around found that syntax wrong. Needs to be:

iothub-explorer monitor-events --login "<SERVICE_CONNECTION_STRING>"

Yay. Finally. All working.

Please consider updating tutorial, and testing against various OS. Thx.

@asergaz
Copy link
Contributor

asergaz commented Jul 11, 2018

@mattjhayes thank you so much for sharing all the details of the troubleshooting steps you've taken. I'm sure it will help others following this tutorial 👍 .

I will take a note of the errors you've got and share it with Product Group, even though the device is sending messages to IoTHub:

Error: Time:Wed Jul 11 22:37:45 2018 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core_ll.c Func:IoTHubClientCore_LL_CreateFromConnectionString Line:892 iotHubName is not found
Error: Time:Wed Jul 11 22:37:45 2018 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core.c Func:create_iothub_instance Line:928 Failure creating iothub handle

My apologies, I had previously missed bit about installing node (suggest moving it to later in the tutorial where it is needed).

The Prerequisites section of this doc needs to be completed after moving to the next steps. This is standard on all other docs.microsoft.com. Hope it helps clarifying.

iothub-explorer monitor-events <HUB_NAME> --login <SERVICE_CONNECTION_STRING>

Please note that <HUB_NAME> is not the IoTHubName but the deviceName. In this tutorial would be "MyPythonDevice" that you created before with:

az iot hub device-identity create --hub-name {YourIoTHubName} --device-id MyPythonDevice

Please consider updating tutorial, and testing against various OS. Thx.

Please correct me if I am wrong but I believe there is nothing to update\change on the tutorial at the moment. I will bring the "Share OS versions where tutorials were tested" topic into discussion for the next versions of the documentation.

Again, thank you so much for bringing all the details of the troubleshoot!

@asergaz
Copy link
Contributor

asergaz commented Jul 11, 2018

We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants