Napalm integration "No module named napalm_base.exceptions" #1391

Closed
opened 2025-12-29 16:31:59 +01:00 by adam · 0 comments
Owner

Originally created by @defo89 on GitHub (Nov 8, 2017).

Issue type

Bug report

Environment

  • Python version: 2.7.9
  • NetBox version: 2.2.4
  • Napalm version: 2.0.0 (via pip install napalm)

Description

NAPALM integration in Netbox is not working with latest versions.

Not sure whether it has something to do with reunification (=>2.0.0).
exceptions.py full path: /usr/local/lib/python2.7/dist-packages/napalm/base/exceptions.py

error1

Current:

/opt/netbox-2.2.4/netbox# ./manage.py nbshell
NetBox interactive shell
Python 2.7.9 | Django 1.11.7 | NetBox 2.2.4
lsmodels() will show available models. Use help(<model>) for more info.
>>> import napalm
>>> from napalm_base.exceptions import ConnectAuthError, ModuleImportError
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named napalm_base.exceptions
>>> 

Fixed:

/opt/netbox-2.2.4/netbox# ./manage.py nbshell
NetBox interactive shell
Python 2.7.9 | Django 1.11.7 | NetBox 2.2.4
lsmodels() will show available models. Use help(<model>) for more info.
>>> import napalm
>>> from napalm.base.exceptions import ConnectAuthError, ModuleImportError 
>>> 

Changing napalm_base to napalm.base /netbox-path/netbox/dcim/api/views.py fixes the issue.

Happy to submit a PR, too.

Note: even with the fix "Status" tab is not working and throws out an error:
error2

But it doesn't seem like an issue with Netbox.

Originally created by @defo89 on GitHub (Nov 8, 2017). <!-- Before opening a new issue, please search through the existing issues to see if your topic has already been addressed. Note that you may need to remove the "is:open" filter from the search bar to include closed issues. Check the appropriate type for your issue below by placing an x between the brackets. For assistance with installation issues, or for any other issues other than those listed below, please raise your topic for discussion on our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please note that issues which do not fall under any of the below categories will be closed. Due to an excessive backlog of feature requests, we are not currently accepting any proposals which extend NetBox's feature scope. Do not prepend any sort of tag to your issue's title. An administrator will review your issue and assign labels as appropriate. ---> ### Issue type Bug report <!-- Unexpected or erroneous behavior --> <!-- Please describe the environment in which you are running NetBox. (Be sure to verify that you are running the latest stable release of NetBox before submitting a bug report.) If you are submitting a bug report and have made any changes to the code base, please first validate that your bug can be recreated while running an official release. --> ### Environment * Python version: 2.7.9 * NetBox version: 2.2.4 * Napalm version: 2.0.0 (via ```pip install napalm```) <!-- BUG REPORTS must include: * A list of the steps needed for someone else to reproduce the bug * A description of the expected and observed behavior * Any relevant error messages (screenshots may also help) FEATURE REQUESTS must include: * A detailed description of the proposed functionality * A use case for the new feature * A rough description of any necessary changes to the database schema * Any relevant third-party libraries which would be needed --> ### Description NAPALM integration in Netbox is not working with latest versions. Not sure whether it has something to do with reunification (=>2.0.0). ```exceptions.py ``` full path: ```/usr/local/lib/python2.7/dist-packages/napalm/base/exceptions.py``` ![error1](https://user-images.githubusercontent.com/13087245/32549545-904e2a02-c492-11e7-9890-03a35807a3bf.png) Current: ``` /opt/netbox-2.2.4/netbox# ./manage.py nbshell NetBox interactive shell Python 2.7.9 | Django 1.11.7 | NetBox 2.2.4 lsmodels() will show available models. Use help(<model>) for more info. >>> import napalm >>> from napalm_base.exceptions import ConnectAuthError, ModuleImportError Traceback (most recent call last): File "<console>", line 1, in <module> ImportError: No module named napalm_base.exceptions >>> ``` Fixed: ``` /opt/netbox-2.2.4/netbox# ./manage.py nbshell NetBox interactive shell Python 2.7.9 | Django 1.11.7 | NetBox 2.2.4 lsmodels() will show available models. Use help(<model>) for more info. >>> import napalm >>> from napalm.base.exceptions import ConnectAuthError, ModuleImportError >>> ``` Changing ```napalm_base``` to ```napalm.base``` **/netbox-path/netbox/dcim/api/views.py** fixes the issue. Happy to submit a PR, too. Note: even with the fix "Status" tab is not working and throws out an error: ![error2](https://user-images.githubusercontent.com/13087245/32549657-f90b8cf6-c492-11e7-8038-a241e32c396c.png) But it doesn't seem like an issue with Netbox.
adam added the type: bug label 2025-12-29 16:31:59 +01:00
adam closed this issue 2025-12-29 16:31:59 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1391