Create superuser for cvat

1k Views Asked by At

I am trying to install cvat, so I am following the Installation guide

The first step run smoothly, however when I try to create a superuser with the command

docker exec -it cvat_server bash -ic 'python3 ~/manage.py createsuperuser'

After a few minutes, I get the following error:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/opt/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/opt/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/opt/venv/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection timed out
    Is the server running on host "cvat_db" (172.18.0.3) and accepting
    TCP/IP connections on port 5432?


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

Traceback (most recent call last):
  File "/home/django/manage.py", line 21, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/venv/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
    return super().execute(*args, **options)
  File "/opt/venv/lib/python3.8/site-packages/django/core/management/base.py", line 397, in execute
    self.check_migrations()
  File "/opt/venv/lib/python3.8/site-packages/django/core/management/base.py", line 486, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/opt/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/opt/venv/lib/python3.8/site-packages/django/db/migrations/loader.py", line 53, in __init__
    self.build_graph()
  File "/opt/venv/lib/python3.8/site-packages/django/db/migrations/loader.py", line 220, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/opt/venv/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations
    if self.has_table():
  File "/opt/venv/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 55, in has_table
    with self.connection.cursor() as cursor:
  File "/opt/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor
    return self._cursor()
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
    self.ensure_connection()
  File "/opt/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/opt/venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/opt/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/opt/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/opt/venv/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not connect to server: Connection timed out
    Is the server running on host "cvat_db" (172.18.0.3) and accepting
    TCP/IP connections on port 5432?

What should I do to fix this and use CVAT?

My Ubuntu version: Ubuntu 22.04.1 LTS

I thought adding Django's authentication system might solve it so I did pip install django-auth but it changed nothing

1

There are 1 best solutions below

0
On

I have had the same problem but I found a solution. Some user suggested a problem with docker installation here. My way to solve it is:

  • Remove docker installation completely. This can help.
  • Install docker from the atp repository:

sudo apt install containerd

sudo apt install docker.io

Do everything as in the CVAT installation guide, but ignore the part about installing Docker and use the commands above. With this solution some comands indicated in the installation guide will require sudo. In the guide:

Instead of docker compose up -d use sudo docker-compose up -d

Run with sudo docker-compose up