<p>I'm writing a Collectd plugin that calls an external API. For this I wish to use the <code>requests</code> Python library. In my collectd.conf file I added:</p>
<p><code><br />LoadPlugin python<br /><Plugin python><br /> ModulePath "/usr/lib/collectd/"<br /> Import "module_name"<br /> <Module module_name><br /> ...<br /> </Module><br /></Plugin><br /></code></p>
<p>In my Python file I imported the packages with:</p>
<p><code>import collectd<br />import requests<br /></code></p>
<p>But I am faced with this error when I start Collectd:</p>
<p><code><br />Apr 23 17:51:30 home collectd[100272]: python plugin: Error importing module "need_restart".<br />Apr 23 17:51:30 home collectd[100272]: Unhandled python exception in importing module: ImportError: dynamic module does not define module export function (PyInit_email)<br /></code></p>
<p>When I remove the <code>import requests</code> line the error disappears. Do I need to provide a path to the external Python packages to import them? From what I understand Collectd launches its own Python interpreter, which might explain the issue with the import.</p>
<p>I did try providing a path to my site-packages, but all in vain:</p>
<p><code><br /> ModulePath "/usr/lib/python3.8/site-packages/"<br /></code></p>

        
        
        
<br/><hr align="left" width="300" />
Sent from the <a href="http://collectd.1051573.n5.nabble.com/">collectd mailing list archive</a> at Nabble.com.<br/>