PaloAltoNetworks / PaloAltoNetworks/pan-os-python
pan-os-python is incompatible with python 3.12 due to missing `distutils` package
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 400
- Forks
- 199
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
The distutils package which is required for the version checks in pan-os-python has been removed in python 3.12.
PEP 632: Remove the distutils package. See the migration guide for advice replacing the APIs it provided. The third-party Setuptools package continues to provide distutils, if you still require it in Python 3.12 and beyond.
Expected behavior
pan-os-python should work.
Current behavior
File "/Users/someuser/.local/pipx/venvs/somevenv/lib/python3.12/site-packages/panos/init.py", line 35, in
from distutils.version import LooseVersion # Used by PanOSVersion class
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'
Possible solution
Follow the migration guide and use the packaging package instead.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in panos/init.py at the distutils.version import used by PanOSVersion. Read the linked PEP 632 migration advice and check the packaging-based replacement. Done means pan-os-python imports and works under Python 3.12 without the ModuleNotFoundError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100