Error loading plugin #4201

Closed
opened 2025-12-29 18:33:50 +01:00 by adam · 3 comments
Owner

Originally created by @kilker12 on GitHub (Oct 20, 2020).

Environment

  • Python version: 3.8.5
  • NetBox version: 2.9.7

Steps to Reproduce

  1. Install clean netbox instance using install instructions
  2. Clone animal_sounds plugin and install using python3 setup.py install
  3. Run python3 manage.py collectstatic

Expected Behavior

python3 manage.py collectstatic to not produce errors

Observed Behavior

(venv) root@netbox-test:/opt/netbox-animal-sounds# python3 /opt/netbox/netbox/manage.py collectstatic
Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
utility.execute()
File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/core/management/init.py", line 377, in execute
django.setup()
File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/opt/netbox-2.9.7/netbox/extras/plugins/init.py", line 64, in ready
template_extensions = import_object(f"{self.module}.{self.template_extensions}")
File "/opt/netbox-2.9.7/netbox/extras/plugins/utils.py", line 31, in import_object
spec.loader.exec_module(module)
AttributeError: 'zipimporter' object has no attribute 'exec_module'

Originally created by @kilker12 on GitHub (Oct 20, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/g/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.8.5 * NetBox version: 2.9.7 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. Install clean netbox instance using install instructions 2. Clone animal_sounds plugin and install using python3 setup.py install 3. Run python3 manage.py collectstatic <!-- What did you expect to happen? --> ### Expected Behavior python3 manage.py collectstatic to not produce errors <!-- What happened instead? --> ### Observed Behavior (venv) root@netbox-test:/opt/netbox-animal-sounds# python3 /opt/netbox/netbox/manage.py collectstatic Traceback (most recent call last): File "/opt/netbox/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute django.setup() File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/opt/netbox-2.9.7/venv/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate app_config.ready() File "/opt/netbox-2.9.7/netbox/extras/plugins/__init__.py", line 64, in ready template_extensions = import_object(f"{self.__module__}.{self.template_extensions}") File "/opt/netbox-2.9.7/netbox/extras/plugins/utils.py", line 31, in import_object spec.loader.exec_module(module) AttributeError: 'zipimporter' object has no attribute 'exec_module'
adam added the type: bugstatus: accepted labels 2025-12-29 18:33:50 +01:00
adam closed this issue 2025-12-29 18:33:50 +01:00
Author
Owner

@DanSheps commented on GitHub (Oct 21, 2020):

This looks like it is related to setuptools installing the plugin as an egg. There are two options, we require all modules to be deployed with zip_safe=False or we alter our loader to accommodate it. Here is some potentially relevant code:

https://github.com/python-mode/python-mode/blob/0.10.0/pymode/libs/pkg_resources/init.py#L2190-L2205

@DanSheps commented on GitHub (Oct 21, 2020): This looks like it is related to setuptools installing the plugin as an egg. There are two options, we require all modules to be deployed with zip_safe=False or we alter our loader to accommodate it. Here is some potentially relevant code: https://github.com/python-mode/python-mode/blob/0.10.0/pymode/libs/pkg_resources/__init__.py#L2190-L2205
Author
Owner

@DanSheps commented on GitHub (Oct 21, 2020):

I have prodded python regarding this issue under https://bugs.python.org/issue19699 but I am going to label this a bug and see if I can find a workable workaround for it.

@DanSheps commented on GitHub (Oct 21, 2020): I have prodded python regarding this issue under https://bugs.python.org/issue19699 but I am going to label this a bug and see if I can find a workable workaround for it.
Author
Owner

@kilker12 commented on GitHub (Nov 10, 2020):

@DanSheps is there any workaround in the mean time?

@kilker12 commented on GitHub (Nov 10, 2020): @DanSheps is there any workaround in the mean time?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4201