Installing python netsnmp on centos 7

I am getting this error fatal error: net-snmp/net-snmp-config.h: No such file or directory

. I have installed gcc, python-devel, net-snmp, net-snmp-utils, net-snmp-python

other development dependencies as well.

CentOS Linux release 7.1.1503 (Core)
[admin@localhost python]$ wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.5.2/net-snmp-5.5.2.tar.gz
[admin@localhost python]$ pwd
/tmp/net-snmp-5.5.2/python
[admin@localhost python]$ python setup.py build
sh: net-snmp-config: command not found
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/netsnmp
copying netsnmp/__init__.py -> build/lib.linux-x86_64-2.7/netsnmp
copying netsnmp/client.py -> build/lib.linux-x86_64-2.7/netsnmp
creating build/lib.linux-x86_64-2.7/netsnmp/tests
copying netsnmp/tests/__init__.py -> build/lib.linux-x86_64-2.7/netsnmp/tests
copying netsnmp/tests/test.py -> build/lib.linux-x86_64-2.7/netsnmp/tests
running build_ext
building 'netsnmp.client_intf' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/netsnmp
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/admin/miniconda/envs/py_env_clink/include/python2.7 -c netsnmp/client_intf.c -o build/temp.linux-x86_64-2.7/netsnmp/client_intf.o
netsnmp/client_intf.c:9:38: fatal error: net-snmp/net-snmp-config.h: No such file or directory
 #include <net-snmp/net-snmp-config.h>
compilation terminated.
error: command 'gcc' failed with exit status 1
[admin@localhost python]$

      

UPDATE1: After running ./configure && make && make install

netsnmp file in dir, I was able to start python setup.py install

. However, I am now getting this error from python:

>>> import netsnmp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "netsnmp/__init__.py", line 1, in <module>
    from client import *
  File "netsnmp/client.py", line 1, in <module>
    import client_intf
ImportError: No module named client_intf
>>> 

      

UPDATE2: My bad! I ran the python interpreter from the netsnmp cd /tmp/net-snmp-master/python/

dets source directory which was throwing the expected error for me as python was not using import from egg but from source. Anyway, after execution cd ~

, I get a new error

>>> import netsnmp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/netsnmp/__init__.py", line 1, in <module>
    #
  File "build/bdist.linux-x86_64/egg/netsnmp/client.py", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/netsnmp/client_intf.py", line 7, in <module>
  File "build/bdist.linux-x86_64/egg/netsnmp/client_intf.py", line 6, in __bootstrap__
ImportError: libnetsnmp.so.30: cannot open shared object file: No such file or directory
>>> exit()

      

Update3

[root@localhost ~]# sudo ldconfig
[root@localhost ~]# sudo ldconfig -p | grep netsnmp
    libnetsnmptrapd.so.31 (libc6,x86-64) => /lib64/libnetsnmptrapd.so.31
    libnetsnmptrapd.so (libc6,x86-64) => /lib64/libnetsnmptrapd.so
    libnetsnmpmibs.so.31 (libc6,x86-64) => /lib64/libnetsnmpmibs.so.31
    libnetsnmpmibs.so (libc6,x86-64) => /lib64/libnetsnmpmibs.so
    libnetsnmphelpers.so.31 (libc6,x86-64) => /lib64/libnetsnmphelpers.so.31
    libnetsnmphelpers.so (libc6,x86-64) => /lib64/libnetsnmphelpers.so
    libnetsnmpagent.so.31 (libc6,x86-64) => /lib64/libnetsnmpagent.so.31
    libnetsnmpagent.so (libc6,x86-64) => /lib64/libnetsnmpagent.so
    libnetsnmp.so.31 (libc6,x86-64) => /lib64/libnetsnmp.so.31
    libnetsnmp.so (libc6,x86-64) => /lib64/libnetsnmp.so
[root@localhost ~]# find / -name libnetsnmp.so*
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/lib64/libnetsnmp.so
/usr/lib64/libnetsnmp.so.31
/usr/lib64/libnetsnmp.so.31.0.2
/usr/local/lib/libnetsnmp.so.30.0.3
/usr/local/lib/libnetsnmp.so.30.0.1
/usr/local/lib/libnetsnmp.so
/usr/local/lib/libnetsnmp.so.30
[root@localhost ~]# 

      

UPDATE4 . Finally, the issue was fixed by running sudo ldconfig

and changing/etc/ld.so.conf.d/libc.conf

[root@localhost ~]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
[root@localhost ~]# cat > /etc/ld.so.conf.d/libc.conf <<EOF
> /usr/local/lib
> EOF
[root@localhost ~]# ldconfig
[root@localhost ~]# python
>>> import netsnmp
>>> exit()
[root@localhost ~]# 

      

+3


source to share


1 answer


Make sure you have installed net-snmp-devel. Check existing / usr / include / net-snmp / net-snmp-config.h



+2


source







All Articles