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

Error installing floorplan_plugin #48

Open
gignat88 opened this issue Oct 2, 2024 · 7 comments
Open

Error installing floorplan_plugin #48

gignat88 opened this issue Oct 2, 2024 · 7 comments

Comments

@gignat88
Copy link

gignat88 commented Oct 2, 2024

Hello,

I have followed guides from https://netboxlabs.com/docs/netbox/en/stable/installation/ and managed to install it. Now i want do install the plugin and i got this error :

:~$ sudo pip install netbox-floorplan-plugin
[sudo] password for netbox:
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

i have activated the virtual environment and got this error :

$ pip install netbox-floorplan-plugin
Collecting netbox-floorplan-plugin
Downloading netbox_floorplan_plugin-0.4.0-py3-none-any.whl.metadata (2.1 kB)
Downloading netbox_floorplan_plugin-0.4.0-py3-none-any.whl (278 kB)
Installing collected packages: netbox-floorplan-plugin
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/opt/netbox/venv/lib/python3.12/site-packages/netbox_floorplan'
Check the permissions.

run it with sudo :

:~$ sudo pip install netbox-floorplan-plugin
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

And here i got blocked. Can anyone help me with a complete guide to install this plugin ?

i have installed NetBox v4.1.3

@maciejopalinski
Copy link

maciejopalinski commented Oct 4, 2024

You forgot this part of the install guide: https://netboxlabs.com/docs/netbox/en/stable/installation/3-netbox/#optional-requirements

You should put the plugins that you want to install in local_requirements.txt. The /opt/netbox/upgrade.sh script will install them in the correct virtual environment for you and do all migrations. This is the recommended way of installing plugins.

Although if you want to install it manually, without the upgrade script, don't do it with sudo because sudo does not have the virtual environment activated. You need to get an interactive root session with sudo -s, activate the virtual environment with source /opt/netbox/venv/bin/activate and only then install the packages using pip.

@maciejopalinski
Copy link

maciejopalinski commented Oct 4, 2024

Also, this plugin will not work with Netbox v4.1.3 as of today. It still waits to be updated to the newest Netbox version in this PR: #49

The latest version this plugin works with as of today is Netbox v4.0.10.

@gignat88
Copy link
Author

gignat88 commented Oct 4, 2024

Hello @maciejopalinski and thx for yor response

Will try tonight to add in local_requirements.txt the line with plugin name.

Will come back with feedback

@gignat88
Copy link
Author

gignat88 commented Oct 5, 2024

even if netbox v 4.1.3 does not support , it could install the plugin and this one will not work or it will not install at all ?

because i have tried to install it and i got the same error over and over ( i've also asked chatgpt and no result )

steps i've followed :

  • i've created file local.requirements.txt

(venv) netbox@netbox-J42-Nano:/opt/netbox$ cat local.requirements.txt
netbox-floorplan-plugin

  • i've installed netbox-floorplan-plugin :

(venv) netbox@netbox-J42-Nano:/opt/netbox$ sudo /opt/netbox/venv/bin/pip install netbox-floorplan-plugin
Collecting netbox-floorplan-plugin
Using cached netbox_floorplan_plugin-0.4.0-py3-none-any.whl.metadata (2.1 kB)
Using cached netbox_floorplan_plugin-0.4.0-py3-none-any.whl (278 kB)
Installing collected packages: netbox-floorplan-plugin
Successfully installed netbox-floorplan-plugin-0.4.0

(venv) netbox@netbox-J42-Nano:/opt/netbox$ /opt/netbox/venv/bin/pip show netbox-floorplan-plugin
Name: netbox-floorplan-plugin
Version: 0.4.0
Summary: Netbox Plugin to support graphical floorplans
Home-page: https://github.com/netbox-community/netbox-floorplan-plugin.git
Author: Tony Nealon
Author-email: [email protected]
License: LGPLv3+
Location: /opt/netbox/venv/lib/python3.12/site-packages
Requires:
Required-by:

(venv) netbox@netbox-J42-Nano:/opt/netbox$ /opt/netbox/venv/bin/pip list | grep netbox-floorplan-plugin
netbox-floorplan-plugin 0.4.0

-i've added in configuration.py :

Enable installed plugins. Add the name of each plugin to the list.
PLUGINS = [
'netbox_floorplan_plugin',
]

Plugins configuration settings. These settings are used by various plugins that the user may have installed.
Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
PLUGINS_CONFIG = {
'my_plugin': {
'foo': 'bar',
'buzz': 'bazz'
}
}

Remote authentication support

this is the error i receive after ./upgrade.sh script running L

Skipping local dependencies (local_requirements.txt not found)
Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "/opt/netbox/netbox/netbox/settings.py", line 801, in
plugin = importlib.import_module(plugin_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'netbox_floorplan_plugin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 104, in wrapper
saved_locale = translation.get_language()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/translation/init.py", line 211, in get_language
return _trans.get_language()
^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/translation/init.py", line 66, in getattr
if settings.USE_I18N:
^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 89, in getattr
self._setup(name)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 76, in _setup
self._wrapped = Settings(settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 190, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/opt/netbox/netbox/netbox/settings.py", line 804, in
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Unable to import plugin netbox_floorplan_plugin: Module not found. Check that the plugin module has been installed within the correct Python environment.
(venv) netbox@netbox-J42-Nano:/opt/netbox$ /opt/netbox/venv/bin/pip show netbox-floorplan-plugin

  • it said that local_requiremets.txt not found, but the file is there :
    (venv) netbox@netbox-J42-Nano:/opt/netbox$ ls
    base_requirements.txt contrib docs local.requirements.txt netbox pyproject.toml requirements.txt SECURITY.md venv
    CHANGELOG.md CONTRIBUTING.md LICENSE.txt mkdocs.yml NOTICE README.md scripts upgrade.sh

(venv) netbox@netbox-J42-Nano:/opt/netbox$ cat local.requirements.txt
netbox-floorplan-plugin

i don't know what to do anymore; although it seems to be very easy to install it it is very complicated

@maciejopalinski
Copy link

Netbox v4.1.3 will not start with this plugin installed, but the plugin can be installed.
There are a couple of mistakes that you are making:

  1. File name is local_requirements.txt (not local.requirements.txt).
  2. Package name is netbox-floorplan-plugin, but in configuration.py you should put: PLUGINS = ['netbox_floorplan'] as per the plugin install docs.

Let me know if that fixed your issues.

@gignat88
Copy link
Author

hello,

1.so i've installed netbox v4.0.11 because plugin netbox_floorplan is compatible with this version

  1. i've created local_requirements.txt and added line "netbox_floorplan" :
    @ :/opt/netbox/netbox/netbox$ cat local_requirements.txt
    netbox-floorplan-plugin

3.i've edited configuration.py and added in plugins field the following :

Enable installed plugins. Add the name of each plugin to the list.

PLUGINS = ['netbox_floorplan']

  1. i've tried to run sudo ./venv/bin/python3 netbox/manage.py makemigrations netbox_floorplan_plugin and got error :
    Traceback (most recent call last):
    File "/opt/netbox/netbox/netbox/settings.py", line 779, in
    plugin = importlib.import_module(plugin_name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "", line 1387, in _gcd_import
    File "", line 1360, in _find_and_load
    File "", line 1324, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'netbox_floorplan'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 454, in execute
self.check()
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 486, in check
all_issues = checks.run_checks(
^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/caches.py", line 64, in check_file_based_cache_is_absolute
for alias, config in settings.CACHES.items():
^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 89, in getattr
self._setup(name)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 76, in _setup
self._wrapped = Settings(settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 190, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/opt/netbox/netbox/netbox/settings.py", line 782, in
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Unable to import plugin netbox_floorplan: Module not found. Check that the plugin module has been installed within the correct Python environment.

from what i see the error is No module named 'netbox_floorplan' so there is a mistype somewere

  1. the same error i've got even when i run upgrade.sh , bellow are the last lines from running upgrade.sh :

Skipping local dependencies (local_requirements.txt not found)
Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "/opt/netbox/netbox/netbox/settings.py", line 779, in
plugin = importlib.import_module(plugin_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'netbox_floorplan'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 104, in wrapper
saved_locale = translation.get_language()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/translation/init.py", line 211, in get_language
return _trans.get_language()
^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/translation/init.py", line 66, in getattr
if settings.USE_I18N:
^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 89, in getattr
self._setup(name)
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 76, in _setup
self._wrapped = Settings(settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/init.py", line 190, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/opt/netbox/netbox/netbox/settings.py", line 782, in
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Unable to import plugin netbox_floorplan: Module not found. Check that the plugin module has been installed within the correct Python environment.

i see that there is also an error that (local_requirements.txt not found) ; i've copied local_requirements.txt from /op/netbox/netbox/netbox/local_requirements.txt to /op/netbox/ and run upgrade and seems that it's ok now :

Running migrations:
Applying netbox_floorplan.0001_initial... OK
Applying netbox_floorplan.0002_floorplan_measurement_unit_alter_floorplan_scale... OK
Applying netbox_floorplan.0003_floorplan_canvas... OK
Applying netbox_floorplan.0004_alter_floorplan_options... OK
Applying netbox_floorplan.0005_alter_floorplan_site... OK
Applying netbox_floorplan.0006_delete_floorplanobject... OK
Applying netbox_floorplan.0007_alter_floorplan_options_and_more... OK
Checking for missing cable paths (python3 netbox/manage.py trace_paths --no-i

  • opened netbox and plugin is installed, but there is no button to add something :
    image

some help please ? thx a lot

@gignat88
Copy link
Author

found : in site have floorplan tab for my site :) noob

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

2 participants