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

Can't load newly installed module #123

Open
dmgeurts-mm opened this issue Jan 11, 2025 · 0 comments
Open

Can't load newly installed module #123

dmgeurts-mm opened this issue Jan 11, 2025 · 0 comments

Comments

@dmgeurts-mm
Copy link

dmgeurts-mm commented Jan 11, 2025

Environment

  • Python version: 3.10.12
  • napalm version: 4.1.0
  • napalm-panos version: 0.6.2

Expected Behavior

Same as when loading nxos:

>>> get_network_driver("nxos")
<class 'napalm.nxos.nxos.NXOSDriver'>

Observed Behavior

The error below, instead of the class being loaded.

$ pip freeze | grep napalm
napalm==4.1.0
napalm-ansible==1.1.0
napalm-core==0.1.2
napalm_panos==0.6.2

The error:

Python 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from napalm import get_network_driver
>>> get_network_driver("panos")
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests_toolbelt/_compat.py", line 48, in <module>
    from requests.packages.urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/napalm/base/__init__.py", line 97, in get_network_driver
    raise e
  File "/usr/local/lib/python3.10/dist-packages/napalm/base/__init__.py", line 88, in get_network_driver
    module = importlib.import_module(module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/dist-packages/napalm_panos/__init__.py", line 20, in <module>
    from napalm_panos.panos import PANOSDriver
  File "/usr/local/lib/python3.10/dist-packages/napalm_panos/panos.py", line 45, in <module>
    import requests_toolbelt
  File "/usr/lib/python3/dist-packages/requests_toolbelt/__init__.py", line 12, in <module>
    from .adapters import SSLAdapter, SourceAddressAdapter
  File "/usr/lib/python3/dist-packages/requests_toolbelt/adapters/__init__.py", line 12, in <module>
    from .ssl import SSLAdapter
  File "/usr/lib/python3/dist-packages/requests_toolbelt/adapters/ssl.py", line 16, in <module>
    from .._compat import poolmanager
  File "/usr/lib/python3/dist-packages/requests_toolbelt/_compat.py", line 50, in <module>
    from urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)
>>>

Native napalm-panos works:

$napalm --vendor panos --user <user> --password "$pass" fw01.some.domain.com call get_facts
{
    "hostname": "fw01",
    "vendor": "Palo Alto Networks",
    "uptime": 3857726.0,
    "os_version": "11.1.4-h7",
    "serial_number": "********",
    "model": "PA-3410",
    "fqdn": "N/A",
    "interface_list": [
        ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant