0

I'm developing plugin Nrpe in Python.

When i try to execute my code it works well on my machine. But when the NRPE execute it, an error occurs : 'No Module named pycurl'

I'm working on CentOs6.10 with Python 3.4 and i've installed pycurl with easy-install, the path to pycurl.py is /usr/lib/python3.4/site-packages//usr/lib/python3.4/site-packages/pycurl.py

And my PYTHONPATH = ['/usr/local/bin', '/usr/lib64/python34.zip', '/usr/lib64/python3.4', '/usr/lib64/python3.4/plat-linux', '/usr/lib64/python3.4/lib-dynload', '/usr/lib64/python3.4/site-packages', '/usr/lib/python3.4/site-packages']

I hope somebody could help me ?

Thanks !

Raihan
  • 1
  • I've modified the PYTHONPATH doing sys.path.append() but i want to know if i can avoid this workaround and why the environment has such behaviour. – Raihan Mar 12 '20 at 14:45
  • What value did you append? Your PYTHONPATH seems right. How does nrpe launch your script? – rolf82 Mar 12 '20 at 17:54
  • I append the full path to the pycurl.py file : sys.append('/usr/lib/python3.4/site-packages/pycurl-7.43.0.5-py3.4-linux-x86_64.egg') – Raihan Mar 13 '20 at 09:02
  • Scripted launched by Centreon – Raihan Mar 13 '20 at 09:06

1 Answers1

0

You probably need something like: python3 -m pip install pycurl

You may want to use: python3 -m pip install --user pycurl or a virtual environment.

pycurl doesn't come with python. You have to install it with pip from pypi.

dstromberg
  • 6,954
  • 1
  • 26
  • 27
  • It's useful to use python3 -m pip, instead of easy_install or calling the pip shell-callable. If you are explicit with your interpreter, than you largely eliminate the problem of installing into one interpreter and running your script(s) with another. – dstromberg Mar 12 '20 at 19:03
  • Thank you for your response but i assume that easy_install uses pip ? However when i try to use pip it gives me 'RuntimeError : Python 3.5 or later is required'. – Raihan Mar 13 '20 at 09:05
  • pip is a newer competitor for easy_install. About the only time I use easy_install anymore is to install pip. If you invoke pip with python3.4 -m pip install pycurl, that may help. – dstromberg Mar 14 '20 at 00:09