-1

I am trying to make connection with my raspberry Pi and my PC windows through MQTT protocol. And I have a problem I cant solve on my PC - I can t import library that I have installed to my program:

import paho.mqtt.client as mqtt

Results in the error

ModuleNotFoundError: No module named 'paho'

The topic was already issued here (Import Error: paho.mqtt.client not found), but solution doesnt work for me.

I see it in the python folder:

C:\Users\mhucl\AppData\Local\Programs\Python\Python310\Lib\site-packages\paho\mqtt\client

I see it in the pip list. But the program can t find it. Do you know where could be the problem? I use python version 3.10.3. I tried it on different PC aswell and the same result. I followed all solutions on youtube, forums and nothing. Thank you very much.

Here are screenshots if someone would like to see:

https://uschovna.cz/zasilka/WLUWM5TNP7HP7GDG-XKP/UCKZFIZHCI

Matouš Hucl
  • 9
  • 1
  • 4
  • `python --version` ? `pip --version` ? `python -c "import sys; print(sys.path)"` ? Is `C:\Users\mhucl\AppData\Local\Programs\Python\Python310\Lib\site-packages` in the path? – phd Mar 22 '22 at 00:34
  • python version is 3.10.3, pip 22.0.4. And yes its in the path. – Matouš Hucl Mar 22 '22 at 12:07
  • I think I got it. I didn t realize that spyder IDE has different python library. So I copy paste the paho library from python to the spyder folder. Thank you very much. – Matouš Hucl Mar 22 '22 at 13:26

1 Answers1

0
pip install paho-mqtt

https://pypi.org/project/paho-mqtt/

I solved my error by using this command

hardillb
  • 54,545
  • 11
  • 67
  • 105