Python Forum
Cannot import easysnmp: ImportError: libnetsnmp.so.30
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot import easysnmp: ImportError: libnetsnmp.so.30
#1
Question 
I'm trying to use easysnmp in a virtual environment, but get an error when I import it:

Output:
(venv) snorton@app7 /fastapi/sv $ python3 Python 3.7.11 (default, Dec 20 2022, 10:51:25) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import easysnmp Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/fastapi/sv/venv/lib/python3.7/site-packages/easysnmp/__init__.py", line 1, in <module> from .easy import ( # noqa File "/fastapi/sv/venv/lib/python3.7/site-packages/easysnmp/easy.py", line 3, in <module> from .session import Session File "/fastapi/sv/venv/lib/python3.7/site-packages/easysnmp/session.py", line 9, in <module> from . import interface ImportError: libnetsnmp.so.30: cannot open shared object file: No such file or directory >>> ---------------------------------------------------------------------------- (venv) snorton@app7 /fastapi/sv $ sudo find / -name libnetsnmp.so* /usr/local/lib/libnetsnmp.so /usr/local/lib/libnetsnmp.so.30 /usr/local/lib/libnetsnmp.so.30.0.3 /usr/lib64/libnetsnmp.so /usr/lib64/libnetsnmp.so.31.0.2 /usr/lib64/libnetsnmp.so.31 ---------------------------------------------------------------------------
Any idea why, and how to fix it?
Reply
#2
is /usr/local/lib/ in PATH ?

echo $PATH
Calab likes this post
Reply
#3
(Jun-08-2023, 08:30 PM)Axel_Erfurt Wrote: is /usr/local/lib/ in PATH ?

echo $PATH
$ echo $PATH
/fastapi/sv/venv/bin:/usr/local/openssl/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/snorton/bin:/home/Tools

Looks like it's not. How do I fix this?

I should note that this script will be run by multiple users, including as a cron job, so I can't just add it to my .bash_profile
Reply
#4
(Jun-08-2023, 08:36 PM)Calab Wrote: Looks like it's not. How do I fix this?

This seems to have fixed it... it that all that was needed or is this something that will always need to be run?

Output:
sudo ldconfig /usr/local/lib
Reply
#5
It could be the variable LD_LIBRARY_PATH
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ImportError: cannot import name 'Pyfhel' from 'Pyfhel' Anldra12 9 3,578 Dec-13-2021, 06:55 PM
Last Post: Anldra12
  EasySNMP Walk/BulkWalk pylance 3 2,099 Nov-29-2021, 12:00 PM
Last Post: pylance
  ImportError: cannot import name 'get_config' russray2008 0 4,761 Sep-20-2021, 02:18 PM
Last Post: russray2008
  ImportError: cannot import name 'Union' from '_ctypes' (unknown location) ciuffoly 15 10,446 Oct-09-2020, 06:58 AM
Last Post: ciuffoly
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,945 Jun-18-2020, 08:07 AM
Last Post: buran
  ImportError: cannot import name 'MidiEvaluator' from 'parser' (Windows 10) spiffspaceman 4 2,696 May-22-2020, 10:16 PM
Last Post: snippsat
  ImportError: cannot import name 'X ' from ' Y' (Unknown location) Arjunpi 1 4,369 Apr-30-2020, 12:56 AM
Last Post: Larz60+
  problem with mapnik in anaconda python 2: from _mapnik import * ImportError: DLL load parsley 0 1,912 Dec-11-2019, 07:50 AM
Last Post: parsley
  getting ImportError: cannot import name 'HAProxyServer' deepakkr3110 0 1,654 Nov-12-2019, 07:48 AM
Last Post: deepakkr3110
  ImportError: cannot import name 'gui' from 'appJar' CabbageMan 1 2,825 Sep-04-2019, 07:31 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020