Raspberry Pi 3 ModuleNotFoundError: No module named 'paho'

The Getting started with Paho Python guide is superb but am getting
“ModuleNotFoundError: No module named ‘paho’”
error

  • Pi 3
  • Fresh rasparian downloaded image
  • update / full-upgrade etc
    ++++++++++++++++++++++
    Update…
    Tried a second time on Pi zero 2w using NON python3 options and looks good
    Uninstalled both pip lines and put back
    pip install paho-mqtt (only)
    Seems good now
    ++++++++++++++++++++++++
    Some example Pup Only and Sub Only examples would be helpful. I am more of a tech person than a programmer but like the features and simplicity of Pi + py + a solderless breadboard.
    I found these kinds of Cayenne examples really helpful back when py+mqtt was still available there.
    Cayenne-MQTT-Python/examples at master · myDevicesIoT/Cayenne-MQTT-Python · GitHub
    Example-01-SendData.py Enable Paho client logging.
    Example-02-ReceiveData.py Enable Paho client logging.
    Example-03-CayenneClient.py Enable Paho client logging.
    Example-04-SendDataOnTrigger.py Update Example-04-SendDataOnTrigger.py
    Thanks again for the well set out getting started section
    ~ A

Hello @picaxe

Welcome to HiveMQ Community! Thank you for reaching out and sharing your feedback on our “Getting Started with Paho Python” guide. I’m glad to hear that you found it useful and that you were able to resolve the initial issue with the Paho module installation on your Raspberry Pi devices.

One of the great advantages of working with Paho MQTT in Python is its flexibility, allowing you to tailor the code to suit your specific needs. For instance, if you want to create a publisher-only setup, you can simply remove the subscriber part of the code. This means you will retain the sections that connect to the MQTT broker and send messages to a topic, but remove the parts that subscribe and listen for messages. If you’re aiming to set up a subscriber-only system, you would do the opposite. Keep the code segments that subscribe to a topic and receive messages, and remove the portions that publish messages.

Kind regards,
Diego from HiveMQ Team