question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DLL load failed: The specified module could not be found.

See original GitHub issue
  • OS and version used: <VERSION> Windows 10

  • Python runtime used: <VERSION> 3.5.5 (Anaconda)

  • SDK version used: <VERSION> 1.4.1

Description of the issue:

I am trying to run the sample SimulatedDevice.py to send telemetry data to my IoThub but I am getting DLL load Failed error

Code sample exhibiting the issue:

import random
import time
import sys

import iothub_client
from iothub_client import IoTHubClient, IoTHubClientError, IoTHubTransportProvider, IoTHubClientResult
from iothub_client import IoTHubMessage, IoTHubMessageDispositionResult, IoTHubError, DeviceMethodReturnValue

MyNodeDevice --output table
CONNECTION_STRING = "REMOVED"

PROTOCOL = IoTHubTransportProvider.MQTT
MESSAGE_TIMEOUT = 10000

TEMPERATURE = 20.0
HUMIDITY = 60
MSG_TXT = "{\"temperature\": %.2f,\"humidity\": %.2f}"

def send_confirmation_callback(message, result, user_context):
    print ( "IoT Hub responded to message with status: %s" % (result) )

def iothub_client_init():
   
    client = IoTHubClient(CONNECTION_STRING, PROTOCOL)
    return client

def iothub_client_telemetry_sample_run():

    try:
        client = iothub_client_init()
        print ( "IoT Hub device sending periodic messages, press Ctrl-C to exit" )

        while True:
           
            temperature = TEMPERATURE + (random.random() * 15)
            humidity = HUMIDITY + (random.random() * 20)
            msg_txt_formatted = MSG_TXT % (temperature, humidity)
            message = IoTHubMessage(msg_txt_formatted)

            prop_map = message.properties()
            if temperature > 30:
              prop_map.add("temperatureAlert", "true")
            else:
              prop_map.add("temperatureAlert", "false")

            print( "Sending message: %s" % message.get_string() )
            client.send_event_async(message, send_confirmation_callback, None)
            time.sleep(1)

    except IoTHubError as iothub_error:
        print ( "Unexpected error %s from IoTHub" % iothub_error )
        return
    except KeyboardInterrupt:
        print ( "IoTHubClient sample stopped" )

if __name__ == '__main__':
    print ( "IoT Hub Quickstart #1 - Simulated device" )
    print ( "Press Ctrl-C to exit" )
    iothub_client_telemetry_sample_run()

Console log of the issue:

 Traceback (most recent call last):
  File "SimulatedDevice.py", line 11, in <module>
    import iothub_client
  File "C:\Users\Waleed\AppData\Local\Programs\Python\Python35\lib\site-packages\iothub_client\__init__.py", line 1, in <module>
    from .iothub_client import *
ImportError: DLL load failed: The specified module could not be found. 

[edit:pierreca:2018-8-12] formatting

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
WaleedSehgalcommented, Aug 27, 2018

@pierreca Yes seems like there is an issue with python versions other than 3.6. Between I was able to run the sample successfully upon setting my environment to python 3.6

3reactions
pierrecacommented, Aug 18, 2018

@tpenland thanks for reporting this. this all seems to confirm we have a problem with python versions that are not 3.6. we’re looking into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DLL load failed: The specified module could not be found ...
It was giving this error: ImportError: DLL load failed: The specified module could not be found. Opened a Visual Studio x64 command prompt....
Read more >
How to Fix Python ImportError: Dll Load Failed Error
In most cases, the "ImportError: Dll Load Failed: The specified module could not be found" error will occur when you import Python libraries ......
Read more >
dll load failed the specified module could not be found (Fix)
importerror: dll load failed: The specified module could not be found error occurs because of the incompatibilities of Microsoft Visual C++ (Visual Studio) ......
Read more >
How to fix “ImportError: DLL load failed: The specified module ...
This error can occur if the required DLL files are missing or if there are conflicts with other versions of the same library....
Read more >
DLL load failed: The Specified Module Could not be Found
The DLL load failed or ImportError: DLL load failed means that any specific module is not downloaded properly. The error code also indicates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found