Label-studio: sqlite3.OperationalError: no such function: JSON_VALID

Created on 19 Mar 2021  路  5Comments  路  Source: heartexlabs/label-studio

Describe the bug
SQLite3 is reporting the 'no such function: JSON_VALID' error message when starting a project.

=> Database and media directory: /root/.local/share/label-studio

Initializing database..
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 411, in execute
return Database.Cursor.execute(self, query)
sqlite3.OperationalError: no such function: JSON_VALID

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

Traceback (most recent call last):
File "/usr/local/bin/label-studio", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/label_studio/server.py", line 238, in main
_apply_database_migrations()
File "/usr/local/lib/python3.6/site-packages/label_studio/server.py", line 57, in _apply_database_migrations
call_command('migrate', '--no-color', verbosity=0)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 168, in call_command
return command.execute(args, *defaults)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(args, *options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(args, *kwargs)
File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 245, in handle
fake_initial=fake_initial,
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/operations/models.py", line 92, in database_forwards
schema_editor.create_model(model)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 324, in create_model
self.execute(sql, params or None)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 142, in execute
cursor.execute(sql, params)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 411, in execute
return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: no such function: JSON_VALID

To Reproduce
Steps to reproduce the behavior:

  1. sudo /usr/local/bin/label-studio start NEW_PROJECT --init

Environment:

  • OS: RHEL 7.9
  • Label Studio Version 1.0.0
  • SQLite 3.8.3

    • Python 3.6.8

    • Django 3.1.4

bug

Most helpful comment

Thank you, @makseq. I downgraded SQLite to the latest stable version (3.35.2) and everything worked as expected. Great work with the 1.0 release!

All 5 comments

As far as I remember the minimal working SQLite version is 3.35, but you have 3.8.

I had SQLite 3.7.1 working with the previous release (Label Studio 0.9.1.post1), but then Django 3.1.4 gave an error that SQLite 3.8.3 or later is required after upgrading to Label Studio 1.0.0.

@dalekube yes, LS 0.9 didn't use sqlite at all.

The fast solution is to use our docker with LS

Thank you, @makseq. I downgraded SQLite to the latest stable version (3.35.2) and everything worked as expected. Great work with the 1.0 release!

Was this page helpful?
0 / 5 - 0 ratings