# ModuleNotFoundErr

**URL:** <https://discourse.nodered.org/t/modulenotfounderr/32877>\
**Category:** General\
**Created:** [14 September 2020 13:39 UTC](https://discourse.nodered.org/t/modulenotfounderr/32877 "2020-09-14T13:39:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dounaite](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dounaite](https://discourse.nodered.org/u/dounaite)\
**Post date:** [14 September 2020 13:39 UTC](https://discourse.nodered.org/t/modulenotfounderr/32877/1 "2020-09-14T13:39:02Z")

</div>

hello,everyone  
i meet problem about python lib import  
i use the exec node to execute a pyhton file which imports paho.mqtt.client  
when i enter python3 xxx.py in terminal,it can run normally but in node-red it has moduleNotFoundError:No module named 'paho'  
the way i use node-red is by entering 'sudo node-red start' in terminal

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 September 2020 15:50 UTC](https://discourse.nodered.org/t/modulenotfounderr/32877/2 "2020-09-14T15:50:46Z")

</div>

> [@dounaite](#):
>
> the way i use node-red is by entering 'sudo node-red start' in terminal

Why do you do that? That will start node-red with a flows file called start.json which is a bit unusual. What OS/hardware are you running on? Did you look at the node red docs Getting Started guide for the recommended way of installing and running node-red on your OS?

The problem is probably down to the path that python uses to find modules, but I don't think that is a problem that most users have when running python in an exec mode so I would start by making sure node-red is installed correctly and you are starting it correctly.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [14 September 2020 15:58 UTC](https://discourse.nodered.org/t/modulenotfounderr/32877/3 "2020-09-14T15:58:53Z")

</div>

I also have to ask why you need the python paho mqtt client when Node-RED already has MQTT nodes as part of the core set....

---

<div class="post-metadata">

**Author:** ![dounaite](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dounaite](https://discourse.nodered.org/u/dounaite)\
**Post date:** [15 September 2020 06:58 UTC](https://discourse.nodered.org/t/modulenotfounderr/32877/4 "2020-09-15T06:58:34Z")

</div>

thank u very much  
i change the start way it doesn't report error any more  
i used to start by command "sudo node-red"  
now i use "sudo systemctl enable nodered.service" it works well

---

<div class="post-metadata">

**Author:** ![dounaite](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dounaite](https://discourse.nodered.org/u/dounaite)\
**Post date:** [15 September 2020 07:12 UTC](https://discourse.nodered.org/t/modulenotfounderr/32877/5 "2020-09-15T07:12:22Z")

</div>

the mqtt broker needs the data that periodically generated from the python file as soon as possible  
i guess sending the data directly may be a little faster?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 September 2020 07:12 UTC](https://discourse.nodered.org/t/modulenotfounderr/32877/6 "2020-09-29T07:12:27Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
