Classifier stoped working after updating to 2.4.17 #653

Closed
opened 2026-02-04 20:34:56 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @konus1 on GitHub (Mar 18, 2025).

Have you read and understood the above guidelines?

yes

📜 What is the name of the script you are using?

Paperless-NGX

📂 What was the exact command used to execute the script?

bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/paperless-ngx.sh)"

📝 Provide a clear and concise description of the issue.

Possibly after updating to Version 2.4.17 the classifier does not work anymore. Could this be a rights problem?

After starting the document classifier manual with
python3 /opt/paperless/src/manage.py document_create_classifier
I get the following error
sqlite3.OperationalError: no such table: documents_tag

The problem was reported to the project paperless-ngx via bugreport https://github.com/paperless-ngx/paperless-ngx/discussions/9376 see there for complete error traceback.

Any hint for debugging is welcome.

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

No response

🔄 Steps to reproduce the issue.

see above
python3 /opt/paperless/src/manage.py document_create_classifier

Paste the full error output (if available).

Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: documents_tag

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

Traceback (most recent call last):
File "/opt/paperless/src/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/paperless/src/documents/management/commands/document_create_classifier.py", line 13, in handle
train_classifier()
File "/usr/local/lib/python3.11/dist-packages/celery/local.py", line 182, in call
return self._get_current_object()(*a, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/celery/app/task.py", line 411, in call
return self.run(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/paperless/src/documents/tasks.py", line 79, in train_classifier
not Tag.objects.filter(matching_algorithm=Tag.MATCH_AUTO).exists()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 1288, in exists
return self.query.has_results(using=self.db)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/query.py", line 660, in has_results
return compiler.has_results()
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/compiler.py", line 1542, in has_results
return bool(self.execute_sql(SINGLE))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/compiler.py", line 1574, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: documents_tag

🖼️ Additional context (optional).

No response

Originally created by @konus1 on GitHub (Mar 18, 2025). ### ✅ Have you read and understood the above guidelines? yes ### 📜 What is the name of the script you are using? Paperless-NGX ### 📂 What was the exact command used to execute the script? bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/paperless-ngx.sh)" ### 📝 Provide a clear and concise description of the issue. Possibly after updating to Version 2.4.17 the classifier does not work anymore. Could this be a rights problem? After starting the document classifier manual with `python3 /opt/paperless/src/manage.py document_create_classifier` I get the following error `sqlite3.OperationalError: no such table: documents_tag` The problem was reported to the project paperless-ngx via bugreport https://github.com/paperless-ngx/paperless-ngx/discussions/9376 see there for complete error traceback. Any hint for debugging is welcome. ### ⚙️ What settings are you using? - [ ] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? _No response_ ### 🔄 Steps to reproduce the issue. see above `python3 /opt/paperless/src/manage.py document_create_classifier` ### ❌ Paste the full error output (if available). Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such table: documents_tag The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/paperless/src/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.11/dist-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/paperless/src/documents/management/commands/document_create_classifier.py", line 13, in handle train_classifier() File "/usr/local/lib/python3.11/dist-packages/celery/local.py", line 182, in __call__ return self._get_current_object()(*a, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/celery/app/task.py", line 411, in __call__ return self.run(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/paperless/src/documents/tasks.py", line 79, in train_classifier not Tag.objects.filter(matching_algorithm=Tag.MATCH_AUTO).exists() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 1288, in exists return self.query.has_results(using=self.db) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/query.py", line 660, in has_results return compiler.has_results() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/compiler.py", line 1542, in has_results return bool(self.execute_sql(SINGLE)) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/compiler.py", line 1574, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 79, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 100, in _execute with self.db.wrap_database_errors: File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 91, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django.db.utils.OperationalError: no such table: documents_tag ### 🖼️ Additional context (optional). _No response_
OVERLORD added the bug label 2026-02-04 20:34:56 +03:00
Author
Owner

@konus1 commented on GitHub (Mar 18, 2025):

Tried some poking around:
`root@paperless-ngx:/opt/paperless/src# python3 manage.py migrate # (1)
Operations to perform:
Apply all migrations: account, admin, auditlog, auth, authtoken, contenttypes, django_celery_results, documents, guardian, mfa, paperless, paperless_mail, sessions, socialaccount
Running migrations:
No migrations to apply.
root@paperless-ngx:/opt/paperless/src# python3 /opt/paperless/src/manage.py document_create_classifier
[2025-03-17 22:37:10,602] [WARNING] [paperless.tasks] Classifier error:


Resource punkt_tab not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('punkt_tab')

For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt_tab/english/

Searched in:
- PosixPath('/usr/share/nltk_data')


`

@konus1 commented on GitHub (Mar 18, 2025): Tried some poking around: `root@paperless-ngx:/opt/paperless/src# python3 manage.py migrate # (1) Operations to perform: Apply all migrations: account, admin, auditlog, auth, authtoken, contenttypes, django_celery_results, documents, guardian, mfa, paperless, paperless_mail, sessions, socialaccount Running migrations: No migrations to apply. root@paperless-ngx:/opt/paperless/src# python3 /opt/paperless/src/manage.py document_create_classifier [2025-03-17 22:37:10,602] [WARNING] [paperless.tasks] Classifier error: ********************************************************************** Resource punkt_tab not found. Please use the NLTK Downloader to obtain the resource: >>> import nltk >>> nltk.download('punkt_tab') For more information see: https://www.nltk.org/data.html Attempted to load tokenizers/punkt_tab/english/ Searched in: - PosixPath('/usr/share/nltk_data') ********************************************************************** `
Author
Owner

@konus1 commented on GitHub (Mar 18, 2025):

I found, that the error ist different when invoking the script directly in the src directory

root@paperless-ngx:/opt/paperless/src# python3 manage.py document_create_classifier
[2025-03-17 22:59:48,061] [WARNING] [paperless.tasks] Classifier error:

Resource punkt_tab not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('punkt_tab')

For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt_tab/english/

Searched in:

  • PosixPath('/usr/share/nltk_data')

I then run

root@paperless-ngx:/opt/paperless/src# python3
Python 3.11.2 (main, May 2 2024, 11:59:08) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import nltk
nltk.download('punkt_tab')
[nltk_data] Downloading package punkt_tab to /usr/share/nltk_data...
[nltk_data] Unzipping tokenizers/punkt_tab.zip.
True
exit()

root@paperless-ngx:/opt/paperless/src# python3 manage.py document_create_classifier
[2025-03-17 23:05:23,684] [INFO] [paperless.tasks] Saving updated classifier model to /opt/paperless/data/classification_model.pickle...

Problem is solved for me.
Thank you for your time and support!

@konus1 commented on GitHub (Mar 18, 2025): I found, that the error ist different when invoking the script directly in the src directory root@paperless-ngx:/opt/paperless/src# python3 manage.py document_create_classifier [2025-03-17 22:59:48,061] [WARNING] [paperless.tasks] Classifier error: Resource punkt_tab not found. Please use the NLTK Downloader to obtain the resource: import nltk nltk.download('punkt_tab') For more information see: https://www.nltk.org/data.html Attempted to load tokenizers/punkt_tab/english/ Searched in: - PosixPath('/usr/share/nltk_data') I then run root@paperless-ngx:/opt/paperless/src# python3 Python 3.11.2 (main, May 2 2024, 11:59:08) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. import nltk nltk.download('punkt_tab') [nltk_data] Downloading package punkt_tab to /usr/share/nltk_data... [nltk_data] Unzipping tokenizers/punkt_tab.zip. True exit() root@paperless-ngx:/opt/paperless/src# python3 manage.py document_create_classifier [2025-03-17 23:05:23,684] [INFO] [paperless.tasks] Saving updated classifier model to /opt/paperless/data/classification_model.pickle... Problem is solved for me. Thank you for your time and support!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#653