etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
576 stars 198 forks source link

Building pysnmp on Ubuntu ppc64le VM #38

Open ArchaB opened 7 years ago

ArchaB commented 7 years ago

Hi,

I am trying to port pysnmp package on Linux ppc64le Ubuntu VM. But when I try to run the runtests.sh script, I get the following error

root@826f2f0aa536:/etingof/pysnmp# sh runtests.sh
Traceback (most recent call last):
  File "examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py", line 17, in <module>
    from pysnmp.hlapi import *
ImportError: No module named pysnmp.hlapi

However the pysnmp package does have the pysnmp/hlapi

root@826f2f0aa536:/etingof/pysnmp# ls pysnmp/hlapi
__init__.py  asyncio  asyncore  auth.py  context.py  lcd.py  transport.py  twisted  varbinds.py

Tried to include the hlapi path in the environment variable PATH, but still didnt help.

Any pointer on how to resolve this would be helpful.

Thanks.

Regards, Archa

etingof commented 7 years ago

It's something about your building environment... Let's see which pysnmp you are importing:

>>> import pysnmp
>>> pysnmp.__path__
['/home/user/pysnmp/pysnmp']

If it's a wrong one, try $PYTHONPATH:

PYTHONPATH=/home/user/pysnmp sh runtests.sh
ArchaB commented 7 years ago

Thanks for the quick response @etingof Am not sure whats going wrong. I tried to change the python script to explicitly import pysnmp. Tests still failed

root@826f2f0aa536:/etingof/pysnmp# PYTHONPATH=/etingof/pysnmp/pysnmp sh runtests.sh
Traceback (most recent call last):
  File "examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py", line 17, in <module>
    import pysnmp
ImportError: No module named pysnmp

But if I try to install pysnmp, it mentions as already installed

root@826f2f0aa536:/etingof/pysnmp# pip install pysnmp
Requirement already satisfied: pysnmp in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: pyasn1>=0.1.8 in /usr/local/lib/python3.5/dist-packages (from pysnmp)
Requirement already satisfied: pysmi in /usr/local/lib/python3.5/dist-packages (from pysnmp)
Requirement already satisfied: pycryptodome in /usr/local/lib/python3.5/dist-packages (from pysnmp)
Requirement already satisfied: ply in /usr/local/lib/python3.5/dist-packages (from pysmi->pysnmp)
InvisibleFunction commented 6 years ago

Does the first line of your script explicitly call another python interpreter?

etingof commented 6 years ago

May be you need to:

export PYTHONPATH=/etingof/pysnmp/pysnmp

to make sure this variable gets into python environment as well?

lextm commented 1 year ago

Assume you use pyenv today, the steps should be,

  1. Use pyenv to select a global Python version, pyenv global 3.11.1.
  2. Install pysnmp for that version python3 -m pip install -e .. from the source code.
  3. Run runtests.sh. You might add $PATHON --version in the script to assert the Python version used matches the version set by pyenv.