nextbox-ui-plugin icon indicating copy to clipboard operation
nextbox-ui-plugin copied to clipboard

No Module named Extras -- 2.10.4

Open WCSLoschy opened this issue 3 years ago • 4 comments

Trying to import this as a plugin in Netbox 2.10.4 and 2.10.3 - same error across both:

Installed through pip3 - did the same thing so I uninstalled and built from source as per the instructions

  • Clone
  • pip3 install .
  • Added to plugins configuration.py file
  • Receive the following error
Jan 31 21:42:24 NETBOX  gunicorn[76450]:       raise ImproperlyConfigured(
Jan 31 21:42:24 NETBOX  gunicorn[76450]:  django.core.exceptions.ImproperlyConfigured: Unable to import plugin nextbox_ui_plugin:Module not found. Check that the p>
Jan 31 21:42:24 NETBOX  gunicorn[76450]:  [2021-01-31 21:42:24 +0000] [76450] [INFO] Worker exiting (pid: 76450)
Jan 31 21:42:24 NETBOX  gunicorn[76444]:  Traceback (most recent call last):
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 209, in run
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       self.sleep()
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line       357, in sleep
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       ready = select.select([self.PIPE[0]], [], [], 1.0)
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line       242, in handle_chld 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       self.reap_workers()
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line       525, in reap_workers
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       raise HaltServer(reason, self.WORKER_BOOT_ERROR)
Jan 31 21:42:24 NETBOX  gunicorn[76444]:  gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
Jan 31 21:42:24 NETBOX  gunicorn[76444]:  During handling of the above exception, another exception occurred:
Jan 31 21:42:24 NETBOX  gunicorn[76444]:  Traceback (most recent call last):
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox/venv/bin/gunicorn", line 8, in <module>
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       sys.exit(run())
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in run 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/app/base.py", line 228, in run 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       super().run()
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       Arbiter(self).run()
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 229, in run 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       self.halt(reason=inst.reason, exit_status=inst.exit_status)
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 342, in halt 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       self.stop()
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 393, in stop 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       time.sleep(0.1)
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       self.reap_workers()
Jan 31 21:42:24 NETBOX  gunicorn[76444]:    File "/opt/netbox-2.10.4/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers 
Jan 31 21:42:24 NETBOX  gunicorn[76444]:       raise HaltServer(reason, self.WORKER_BOOT_ERROR)
Jan 31 21:42:24 NETBOX  gunicorn[76444]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
Jan 31 21:42:24 NETBOX  systemd[1]: netbox.service: Main process exited, code=exited, status=1/FAILURE
Jan 31 21:42:24 NETBOX  systemd[1]: netbox.service: Failed with result 'exit-code'.
Jan 31 21:42:27 NETBOX  sudo[76453]: user : TTY=console ; PWD=/nextbox-ui-plugin ; USER=root ; COMMAND=/usr/bin/journalctl -e 
Jan 31 21:42:27 NETBOX sudo[76453]: pam unix(sudo:session): session opened for user

I then tried importing it through python3 cli:

» import nextbox_ui_plugin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nextbox-ui-plugin/nextbox_ui_plugin/__init__.py", line 1, in <module> 
    from extras.plugins import PluginConfig
ModuleNotFoundError: No module named 'extras'

Thanks

WCSLoschy avatar Jan 31 '21 21:01 WCSLoschy

Could you check if a proper virtual environment is used by pip3? Are you activating /opt/netbox-2.10.4/venv? Is it a bare VM or Docker NetBox deployment?

iDebugAll avatar Feb 01 '21 16:02 iDebugAll

@iDebugAll Yep! I'm activating the VENV through source /opt/netbox/venv/bin/activate It's an LXC deployment through Ubuntu 20.04 image. (Also ubuntu 20.04 base)

WCSLoschy avatar Feb 02 '21 23:02 WCSLoschy

The upstream docker image you build upon had some breaking changes recently, maybe that causes it https://github.com/netbox-community/netbox-docker/releases/tag/1.0.0 https://hub.docker.com/layers/netboxcommunity/netbox/v2.10.4/images/sha256-dad412d54c6ea5f57a0ed6ffd3d87df69772c8229bb426fc6d28ba75741bacc1?context=explore Is already on that scheme

MaxRink avatar Feb 03 '21 18:02 MaxRink

@WCSLoschy

I'm activating the VENV through source /opt/netbox/venv/bin/activate It's an LXC deployment through Ubuntu 20.04 image. (Also ubuntu 20.04 base)

The thing is NetBox venv seems to be located in /opt/netbox-2.10.4/venv/ as per traceback you provided. You may need to use /opt/netbox-2.10.4/venv/bin/activate for the plugin installation in this case.

iDebugAll avatar Feb 12 '21 20:02 iDebugAll