ModuleNotFoundError: No module named 'storages' #8863

Closed
opened 2025-12-29 20:42:17 +01:00 by adam · 1 comment
Owner

Originally created by @ScorpionKing34 on GitHub (Nov 21, 2023).

NetBox version

v3.5.6

Python version

3.10

Steps to Reproduce

  1. I followed the instructions of 'https://www.howtoforge.com/how-to-install-netbox-network-documentation-and-management-tool-on-ubuntu-22-04/#step-5---configure-netbox' and upon running the installer I get the following error:

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 228, in
import storages.utils # type: ignore
ModuleNotFoundError: No module named 'storages'

By default, uploaded media is stored on the local filesystem. Using Django-storages is also supported. Provide the
class path of the storage driver in STORAGE_BACKEND and any configuration options in STORAGE_CONFIG. For example:
STORAGE_BACKEND = 'storages.backends.s3boto3.S3Boto3Storage'
STORAGE_CONFIG = {
'AWS_ACCESS_KEY_ID': 'Key ID',
'AWS_SECRET_ACCESS_KEY': 'Secret',
'AWS_STORAGE_BUCKET_NAME': 'netbox',
'AWS_S3_REGION_NAME': 'eu-west-1',
}

Is Django-storages a requirement to run Netbox?

After running command 'sudo sh -c "echo 'django-storages' >> /opt/netbox/local_requirements.txt"' the current error is resolved, but now I have a different error:

psycopg.errors.InsufficientPrivilege: permission denied for schema public
LINE 1: CREATE TABLE "django_migrations" ("id" bigint NOT NULL PRIMA...
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 70, in ensure_schema
editor.create_model(self.Migration)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 451, in create_model
self.execute(sql, params or None)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/postgresql/schema.py", line 45, in execute
return super().execute(sql, params)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 201, in execute
cursor.execute(sql, params)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 87, in _execute
return self.cursor.execute(sql)
File "/opt/netbox/venv/lib/python3.10/site-packages/psycopg/cursor.py", line 737, in execute
raise ex.with_traceback(None)
django.db.utils.ProgrammingError: permission denied for schema public
LINE 1: CREATE TABLE "django_migrations" ("id" bigint NOT NULL PRIMA...
^
SQL commands I ran:
bcens-nb01@e1lsar9003nb:~$ sudo -i -u postgres psql
postgres=# CREATE DATABASE netbox;
postgres-# CREATE USER netbox WITH PASSWORD '*********';
postgres-# ALTER DATABASE netbox OWNER TO netbox;
postgres=# GRANT CREATE ON SCHEMA public TO netbox;
postgres-# \q

tried also with GRANT ALL ON SCHEMA public TO netbox;

$ psql --username netbox --password --host localhost netbox
Password:
psql (16.1 (Ubuntu 16.1-1.pgdg22.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.

netbox=>\conninfo
You are connected to database "netbox" as user "netbox" on host "localhost" (address "127.0.0.1") at port "5432".
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Expected Behavior

Is not clear which output to expect, the tutorial on 'https://www.howtoforge.com/how-to-install-netbox-network-documentation-and-management-tool-on-ubuntu-22-04/#step-6---install-netbox' does not provide any expected output.

Observed Behavior

Originally created by @ScorpionKing34 on GitHub (Nov 21, 2023). ### NetBox version v3.5.6 ### Python version 3.10 ### Steps to Reproduce 1. I followed the instructions of 'https://www.howtoforge.com/how-to-install-netbox-network-documentation-and-management-tool-on-ubuntu-22-04/#step-5---configure-netbox' and upon running the installer I get the following error: 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 228, in <module> import storages.utils # type: ignore ModuleNotFoundError: No module named 'storages' By default, uploaded media is stored on the local filesystem. Using Django-storages is also supported. Provide the class path of the storage driver in STORAGE_BACKEND and any configuration options in STORAGE_CONFIG. For example: STORAGE_BACKEND = 'storages.backends.s3boto3.S3Boto3Storage' STORAGE_CONFIG = { 'AWS_ACCESS_KEY_ID': 'Key ID', 'AWS_SECRET_ACCESS_KEY': 'Secret', 'AWS_STORAGE_BUCKET_NAME': 'netbox', 'AWS_S3_REGION_NAME': 'eu-west-1', } Is Django-storages a requirement to run Netbox? After running command 'sudo sh -c "echo 'django-storages' >> /opt/netbox/local_requirements.txt"' the current error is resolved, but now I have a different error: psycopg.errors.InsufficientPrivilege: permission denied for schema public LINE 1: CREATE TABLE "django_migrations" ("id" bigint NOT NULL PRIMA... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 70, in ensure_schema editor.create_model(self.Migration) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 451, in create_model self.execute(sql, params or None) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/postgresql/schema.py", line 45, in execute return super().execute(sql, params) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 201, in execute cursor.execute(sql, params) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 87, in _execute return self.cursor.execute(sql) File "/opt/netbox/venv/lib/python3.10/site-packages/psycopg/cursor.py", line 737, in execute raise ex.with_traceback(None) django.db.utils.ProgrammingError: permission denied for schema public LINE 1: CREATE TABLE "django_migrations" ("id" bigint NOT NULL PRIMA... ^ SQL commands I ran: bcens-nb01@e1lsar9003nb:~$ sudo -i -u postgres psql postgres=# CREATE DATABASE netbox; postgres-# CREATE USER netbox WITH PASSWORD '*********'; postgres-# ALTER DATABASE netbox OWNER TO netbox; postgres=# GRANT CREATE ON SCHEMA public TO netbox; postgres-# \q tried also with GRANT ALL ON SCHEMA public TO netbox; $ psql --username netbox --password --host localhost netbox Password: psql (16.1 (Ubuntu 16.1-1.pgdg22.04+1)) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off) Type "help" for help. netbox=>\conninfo You are connected to database "netbox" as user "netbox" on host "localhost" (address "127.0.0.1") at port "5432". SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off) $ cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy ### Expected Behavior Is not clear which output to expect, the tutorial on 'https://www.howtoforge.com/how-to-install-netbox-network-documentation-and-management-tool-on-ubuntu-22-04/#step-6---install-netbox' does not provide any expected output. ### Observed Behavior
adam closed this issue 2025-12-29 20:42:18 +01:00
Author
Owner

@ScorpionKing34 commented on GitHub (Nov 21, 2023):

FIXED ALL ISSUES.
Bug report is no been closed.

@ScorpionKing34 commented on GitHub (Nov 21, 2023): FIXED ALL ISSUES. Bug report is no been closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8863