On MacOS, how to use netsnmp in python3?
I have already install python3-netsmp, but import still gets an error.
pip3 install python3-netsnmp
% pip3 list
Package Version
--------------- -------
altgraph 0.17.2
bcrypt 4.0.1
cffi 1.15.1
cryptography 40.0.2
future 0.18.2
macholib 1.15.2
paramiko 3.1.0
pip 23.1.2
pycparser 2.21
PyNaCl 1.5.0
python3-netsnmp 1.1a1
setuptools 58.0.4
six 1.15.0
wheel 0.37.0
% python3
Python 3.9.6 (default, Mar 10 2023, 20:16:38)
[Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import netsnmp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jus*/Library/Python/3.9/lib/python/site-packages/netsnmp/__init__.py", line 1, in <module>
from .client import *
File "/Users/jus*/Library/Python/3.9/lib/python/site-packages/netsnmp/client.py", line 5, in <module>
from netsnmp import client_intf
ImportError: dlopen(/Users/jus*/Library/Python/3.9/lib/python/site-packages/netsnmp/client_intf.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_netsnmp_transport_config_compare'
Any suggestions? Thanks!
I did some research and some threads mentioned the setup steps on Ubuntu OS. To use netsnmp, the user should install python-dev, libsnmp-dev, snmp-mibs-downloader in advance. I check it on an Ubuntu VM and it works.
The problem is how to install these packages on Mac OS. I cannot find the packages of libsnmp-dev & snmp-mibs-downloader on Mac OS.
sudo apt-get install gcc python-dev
sudo apt-get install libsnmp-dev snmp-mibs-downloader