Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'pyasn1.compat.octets' #113

Closed
cpackham-atlnz opened this issue Sep 11, 2024 · 15 comments
Closed

ModuleNotFoundError: No module named 'pyasn1.compat.octets' #113

cpackham-atlnz opened this issue Sep 11, 2024 · 15 comments
Labels
area:pysnmp PySNMP package dependencies Pull requests that update a dependency file workaround available While this is a bug, feasible workarounds exist so users can continue their work.

Comments

@cpackham-atlnz
Copy link

Expected behavior

We have a script that had been happily using pysnmp to do some mib parsing.

Actual behavior

After an update we started getting the following traceback

Traceback (most recent call last):
  File "./tools/check-mibs", line 14, in <module>
    from pysnmp.smi import builder, view, compiler
  File ".venv/lib/python3.10/site-packages/pysnmp/smi/builder.py", line 17, in <module>
    from pysnmp import debug, version as pysnmp_version
  File ".venv/lib/python3.10/site-packages/pysnmp/debug.py", line 10, in <module>
    from pyasn1.compat.octets import octs2ints
ModuleNotFoundError: No module named 'pyasn1.compat.octets'

Looks like pyasn1.compat.octets was removed in pyasn1/pyasn1@6f770ba

Detailed steps

I can provide the script we're using if required but hopefully the traceback is enough to go on.

Python package information

7.0.3

Operating system information

Linux (ubuntu 22.04)

Python information

3.10

(Optional) Contents of your test script

No response

Relevant log output

Traceback (most recent call last):
  File "./tools/check-mibs", line 14, in <module>
    from pysnmp.smi import builder, view, compiler
  File ".venv/lib/python3.10/site-packages/pysnmp/smi/builder.py", line 17, in <module>
    from pysnmp import debug, version as pysnmp_version
  File ".venv/lib/python3.10/site-packages/pysnmp/debug.py", line 10, in <module>
    from pyasn1.compat.octets import octs2ints
ModuleNotFoundError: No module named 'pyasn1.compat.octets'
@cpackham-atlnz cpackham-atlnz added bug Something isn't working triage New issues that need to be sorted out. labels Sep 11, 2024
@cpackham-atlnz
Copy link
Author

Looks like it could be fixed by (re)borrowing the hexdump() function from pyasn1 https://github.com/pyasn1/pyasn1/blob/0f07d7242a78ab4d129b26256d7474f7168cf536/pyasn1/debug.py#L126

@cpackham-atlnz
Copy link
Author

Actually that's just the thin end of the wedge. Lots more usages of pyasn1.compat.octets after we get past that one.

@lextm lextm closed this as completed Sep 11, 2024
@lextm
Copy link

lextm commented Sep 11, 2024

Multiple new releases have been out with the fix.

Users can pin pyasn1 to 0.6.0 or upgrade to a suitable new release (6.1.4, 6.2.6, and 7.1.0).

@lextm lextm added area:pysnmp PySNMP package dependencies Pull requests that update a dependency file workaround available While this is a bug, feasible workarounds exist so users can continue their work. and removed bug Something isn't working triage New issues that need to be sorted out. labels Sep 11, 2024
@jaltendorfer
Copy link

When is the pypi release?

@jaltendorfer
Copy link

@lextm

@WibblyGhost
Copy link

@lextm Where do the versions 6.1.4, 6.2.6, and 7.1.0 come into play? I see you have updated your changelog on your webpage but there has been no PyPi releases past 6.2.

@lextm
Copy link

lextm commented Sep 11, 2024

Please read etingof#429. Our team have taken over Ilya's PyPI packages, so you should switch to the packages without LeXtudio postfix now.

@WibblyGhost
Copy link

Please read etingof#429. Our team have taken over Ilya's PyPI packages, so you should switch to the packages without LeXtudio postfix now.

Oh interesting that finally went through, congrats.
Could you properly deprecate pysnmp-lextudio in that case, believe something like this https://peps.python.org/pep-0423/#how-to-rename-a-project. Or add a deprecation warning to a new version of pysnmp-lextudio to give us that notification. As the migration flew under the radar without notification.

@cpackham-atlnz
Copy link
Author

Thanks for getting the release onto pypi. I've upgraded our tooling to use it and it's all working as expected.

@lextm lextm pinned this issue Sep 11, 2024
@Jellyfrog
Copy link

@lextm sorry for slightly off-topic; snmpsim needs updating/pinning of 0.6.0 also! ( snpmsim repo doesn't have issues enabled)

@lextm
Copy link

lextm commented Sep 12, 2024

@Jellyfrog You can create a new issue to track that on this repo.

@grant-allan-ctct
Copy link

Sorry, even though I see that this has been fixed upstream, I don't know how to repair this for my usage.

Using a requirements.txt file, I am currently pinned to:
pysnmp-lextudio==6.0.1

Based on the information in this thread, I am guessing that I should change this to pysnmp==6.0.1 in order to receive the fix. Is that correct?

@lextm
Copy link

lextm commented Sep 12, 2024

@grant-allan-ctct release 6.0 reaches end of life on Sep 23, 2024, so you have to upgrade to 6.1.4 or 6.2.6.

@grant-allan-ctct
Copy link

Thank you @lextm - but of pysnmp-lexstudio or pysnmp - or do they work out to be equivalent? (Please excuse my ignorance.)

@lextm
Copy link

lextm commented Sep 12, 2024

@grant-allan-ctct Scroll up please. Already answered.

@lextudio lextudio locked and limited conversation to collaborators Sep 12, 2024
@lextm lextm unpinned this issue Oct 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:pysnmp PySNMP package dependencies Pull requests that update a dependency file workaround available While this is a bug, feasible workarounds exist so users can continue their work.
Projects
None yet
Development

No branches or pull requests

6 participants