Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: type object 'CustomRESTRequestModel' has no attribute 'model_json_schema' #2336

Open
HYX-smallmang opened this issue Mar 17, 2024 · 1 comment

Comments

@HYX-smallmang
Copy link

How to reproduce the behaviour

When I enter "doccano task" in the Anaconda Prompt window, I get an error:

(base) C:\Users\HYX>doccano task
[2024-03-17 11:08:22 +0800] [4360] [INFO] [django_drf_filepond.apps::ready::61] App init: no django-storages backend configured, using default (local) storage backend if set, otherwise you need to manage file storage independently of this app.
Starting task queue.
[2024-03-17 11:08:23 +0800] [4360] [INFO] [numexpr.utils::_init_num_threads::148] Note: NumExpr detected 16 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
[2024-03-17 11:08:23 +0800] [4360] [INFO] [numexpr.utils::init_num_threads::160] NumExpr defaulting to 8 threads.
[2024-03-17 11:08:24 +0800] [4360] [ERROR] [celery.utils.dispatch.signal::send::280] Signal handler <bound method DjangoFixup.on_import_modules of <celery.fixups.django.DjangoFixup object at 0x0000022456D14590>> raised: AttributeError("type object 'CustomRESTRequestModel' has no attribute 'model_json_schema'")
Traceback (most recent call last):
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\utils\dispatch\signal.py", line 276, in send
response = receiver(signal=self, sender=sender, **named)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\fixups\django.py", line 97, in on_import_modules
self.worker_fixup.validate_models()
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\fixups\django.py", line 137, in validate_models
run_checks()
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config
return check_resolver(resolver)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\resolvers.py", line 494, in check
for pattern in self.url_patterns:
^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\utils\functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\utils\functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\config\urls.py", line 65, in
path("v1/projects/int:project_id/", include("auto_labeling.urls")),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\auto_labeling\urls.py", line 3, in
from .views import (
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\auto_labeling\views.py", line 6, in
from auto_labeling_pipeline.menu import Options
File "C:\Users\HYX\anaconda3\Lib\site-packages\auto_labeling_pipeline\menu.py", line 58, in
Options.register(
File "C:\Users\HYX\anaconda3\Lib\site-packages\auto_labeling_pipeline\menu.py", line 46, in register
schema = model.model_json_schema()
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'CustomRESTRequestModel' has no attribute 'model_json_schema'
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\HYX\anaconda3\Scripts\doccano.exe_main
.py", line 7, in
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\cli.py", line 177, in main
args.handler(args)
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\cli.py", line 110, in command_run_task_queue
app.worker_main(argv=argv)
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\app\base.py", line 389, in worker_main
self.start(argv=argv)
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\app\base.py", line 369, in start
celery.main(args=argv, standalone_mode=False)
File "C:\Users\HYX\anaconda3\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\click\core.py", line 783, in invoke
return _callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\click\decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\bin\base.py", line 134, in caller
return f(ctx, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\bin\worker.py", line 348, in worker
worker = app.Worker(
^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\worker\worker.py", line 93, in init
self.app.loader.init_worker()
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\loaders\base.py", line 110, in init_worker
self.import_default_modules()
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\loaders\base.py", line 104, in import_default_modules
raise response
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\utils\dispatch\signal.py", line 276, in send
response = receiver(signal=self, sender=sender, **named)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\fixups\django.py", line 97, in on_import_modules
self.worker_fixup.validate_models()
File "C:\Users\HYX\anaconda3\Lib\site-packages\celery\fixups\django.py", line 137, in validate_models
run_checks()
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config
return check_resolver(resolver)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\resolvers.py", line 494, in check
for pattern in self.url_patterns:
^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\utils\functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\utils\functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\config\urls.py", line 65, in
path("v1/projects/int:project_id/", include("auto_labeling.urls")),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\site-packages\django\urls\conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HYX\anaconda3\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\auto_labeling\urls.py", line 3, in
from .views import (
File "C:\Users\HYX\anaconda3\Lib\site-packages\backend\auto_labeling\views.py", line 6, in
from auto_labeling_pipeline.menu import Options
File "C:\Users\HYX\anaconda3\Lib\site-packages\auto_labeling_pipeline\menu.py", line 58, in
Options.register(
File "C:\Users\HYX\anaconda3\Lib\site-packages\auto_labeling_pipeline\menu.py", line 46, in register
schema = model.model_json_schema()
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'CustomRESTRequestModel' has no attribute 'model_json_schema'

Your Environment

  • Operating System: windows
  • Python Version Used: 3.11.5
  • When you install doccano:
  • How did you install doccano (Heroku button etc):
@litongyun233
Copy link

遇到同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants