I am trying to run this example program – http://pysnmp.sourceforge.net/examples/1.x/snmpbulk.html
I am on Mac OS X, and I installed pysnmp by –
$ sudo /usr/local/bin/pip install pysnmp
Now when I run the program I get –
Traceback (most recent call last):
File "pysnmptest.py", line 2, in <module>
from pysnmp import msession
ImportError: cannot import name msession
UPDATE:
seems like pysnmp 4.x doesn’t have msession, so I tried http://pysnmp.sourceforge.net/examples/4.x/v3arch/index.html
and now I get –
Traceback (most recent call last):
File "pysnmptest.py", line 2, in <module>
from pysnmp.entity.rfc3413.oneliner import cmdgen
File "/Library/Python/2.6/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 2, in <module>
from pysnmp.entity import engine, config
File "/Library/Python/2.6/site-packages/pysnmp/entity/engine.py", line 2, in <module>
from pysnmp.proto.rfc3412 import MsgAndPduDispatcher
File "/Library/Python/2.6/site-packages/pysnmp/proto/rfc3412.py", line 3, in <module>
from pysnmp.smi import builder, instrum
File "/Library/Python/2.6/site-packages/pysnmp/smi/builder.py", line 4, in <module>
from pysnmp.smi import error
File "/Library/Python/2.6/site-packages/pysnmp/smi/error.py", line 1, in <module>
from pyasn1.error import PyAsn1Error
ImportError: No module named pyasn1.error
The webpage also says they have dependencies on third-party libraries –
Latest PySNMP releases (4.x and later)
depend on the following:ASN.1 library for Python used for
handling ASN.1 objects Python
Cryptography Toolkit used for SNMP
message authentication and encryption
How do I install them? and would it better to install from the tarball from webpage directly?
which version of
pysmnpdid you install? The example you’re trying to run seems to be suited for the 1.x version ofpysnmp.Here I’ve found examples for the newest 4.x version. Note they don’t use
msessionso I guess it was removed.EDIT: Looks like now you have to install
pyasn1from here…I don’t use OSX so I don’t know what’s the better method for installing software on it. On ubuntu I just did
apt-get install python-pysnmpand the whole thing was installed.