HumanSignal / HumanSignal/label-studio
django.db.utils.OperationalError: no such column: "project" - should this be a string literal in single-quotes?
- Dominant language
- TypeScript
- Stars
- 28.3k
- Forks
- 3.7k
- Avg merge
- 14h
- Merged PRs (30d)
- 15
Description
**Describe the bug**
After the installation via `pip install label-studio` it crashes upon start with an error message.
**To Reproduce**
Steps to reproduce the behavior:
1. `python -m venv label-studio`
2. `cd label-studio`
3. `source bin/activate`
4. `pip install label-studio`
5. `label-studio start --data-dir ~/data --no-browser`
**Expected behavior**
Label Studio should start and run.
**Screenshots**
```
=> Database and media directory: /home/labelstudio/.local/share/label-studio
=> Static URL is set to: /static/
=> Database and media directory: /home/labelstudio/data
=> Static URL is set to: /static/
Read environment variables from: /home/labelstudio/data/.env
get 'SECRET_KEY' casted as '' with default ''
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /pypi/label-studio/json HTTP/1.1" 200 33344
Initializing database..
Traceback (most recent call last):
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 324, in execute
return super().execute(query)
^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such column: "project" - should this be a string literal in single-quotes?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/labelstudio/server/bin/label-studio", line 8, in
sys.exit(main())
^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/label_studio/server.py", line 297, in main
_apply_database_migrations()
File "/home/labelstudio/server/lib/python3.11/site-packages/label_studio/server.py", line 62, in _apply_database_migrations
call_command('migrate', '--no-color', verbosity=0)
File "/home/labelstudio/server/lib/python3.11/site-packages/django/core/management/__init__.py", line 194, in call_command
return command.execute(*args, **defaults)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/migrations/operations/models.py", line 659, in database_forwards
alter_together(
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 554, in alter_unique_together
self._delete_composed_index(
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 592, in _delete_composed_index
constraint_names = self._constraint_names(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 1772, in _constraint_names
constraints = self.connection.introspection.get_constraints(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/sqlite3/introspection.py", line 312, in get_constraints
table_schema = cursor.execute(
^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/sentry_sdk/utils.py", line 1788, in runner
return sentry_patched_function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/sentry_sdk/integrations/django/__init__.py", line 653, in execute
result = real_execute(self, sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/labelstudio/server/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 324, in execute
return super().execute(query)
^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such column: "project" - should this be a string literal in single-quotes?
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-C to quit
```
**Environment (please complete the following information):**
- OS: FreeBSD 14.1
- Label Studio Version 1.14.0.post0
- Python 3.11.10
**Additional context**
I looked around and the sqlite3 database is created and contains some tables:
```
% sqlite3 data/label_studio.sqlite3
SQLite version 3.46.1 2024-08-13 09:16:08
Enter ".help" for usage hints.
sqlite> .tables
auth_group htx_user_user_permissions
auth_group_permissions organization
auth_permission organizations_organizationmember
authtoken_token project
django_admin_log projects_projectmember
django_content_type projects_projectonboarding
django_migrations projects_projectonboardingsteps
htx_user projects_projectsummary
htx_user_groups projects_projecttemplate
sqlite>
```
I tried to install globally instead of in an virtual environment but the behaviour and error stays the same.
Contributor guide
Assessment
This issue has not been assessed yet.