paho.mqtt.python icon indicating copy to clipboard operation
paho.mqtt.python copied to clipboard

Issue with Python 3.10.2? ModuleNotFoundError: No module named 'paho'?

Open Jibun-no-Kage opened this issue 2 years ago • 3 comments

Issue with Python 3.10.2? ModuleNotFoundError: No module named 'paho'?

I have Python 3.9.2 and 3.10.2 installed. When I run a given script under 3.9 it works, but on 3.10 it fails with the above error.

I installed paho.mqtt module via pip3 install paho-mqtt. Seem like the install was somehow 3.9 specific?

# pip3 install paho-mqtt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.9/dist-packages (1.6.1)

No sure if this a side effect of the module installation or how Python 3.10.2 was installed?

Jibun-no-Kage avatar Jan 25 '22 06:01 Jibun-no-Kage

This looks like an environment issue on your machine.

I have Python 3.9.2 and 3.10.2 installed.

How? Using virtualenvs?

CamDavidsonPilon avatar Jan 25 '22 14:01 CamDavidsonPilon

Just installed 3.10.2 from source, so it defaults to /usr/local/bin. Just started a simple script... to play with it, and I happen to grab one that used mqtt.

Jibun-no-Kage avatar Jan 26 '22 07:01 Jibun-no-Kage

Installing a new Python will wipe out any old packages. You likely need to reinstall paho with pip3.

CamDavidsonPilon avatar Jan 26 '22 13:01 CamDavidsonPilon

Closing this due to inactivity; if the problem persists please reopen.

MattBrittan avatar Dec 24 '23 21:12 MattBrittan

facing same issue, when running "pip3 install paho-mqtt" it says requirement already satisfied. but while running the code it says,
"ModuleNotFoundError: No module named 'paho'"

Nehal98 avatar Jan 06 '24 22:01 Nehal98

@Nehal98 you would need to provide significantly more information (python versions, OS, use of virtualenvs etc). Consider opening a new issue (or, for a quicker answer, search for the error on StackOverflow and try asking there if existing questions don't help) as this issue is a couple of years old (which is why I closed it).

MattBrittan avatar Jan 06 '24 23:01 MattBrittan