HumanSignal / label-studio

Label Studio is a multi-type data labeling and annotation tool with standardized output format
https://labelstud.io
Apache License 2.0
18.38k stars 2.31k forks source link

Runtime error in export to YOLO #2907

Open zbyte opened 2 years ago

zbyte commented 2 years ago

Describe the bug Export project to YOLO format. System crash with error.


Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/label-studio/label_studio/data_export/api.py", line 183, in get
    export_stream, content_type, filename = DataExport.generate_export_file(
  File "/label-studio/label_studio/data_export/models.py", line 173, in generate_export_file
    shutil.make_archive(tmp_dir, 'zip', tmp_dir)
  File "/usr/lib/python3.8/shutil.py", line 1032, in make_archive
    save_cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

To Reproduce Steps to reproduce the behavior:

  1. Go to project
  2. Click on Export, chose YOLO format
  3. Click on Export button.
  4. See error

Expected behavior Archive in YOLO format downloaded

Environment (please complete the following information):

Additional context Full logs from server:


[07/Sep/2022 09:50:48] "GET /api/projects/10/export/formats HTTP/1.0" 200 2938
[07/Sep/2022 09:50:48] "GET /api/projects/10/export/files HTTP/1.0" 200 19
[07/Sep/2022 09:50:48] "GET /api/projects/10 HTTP/1.0" 200 2356
[2022-09-07 09:51:00,426] [data_export.models::save_export_files::106] [ERROR] Version is not detected in save_export_files()
[2022-09-07 09:51:00,664] [label_studio_converter.converter::convert_to_yolo::627] [WARNING] Unknown label type or labels are empty: {'choices': ['NoPeople'], 'type': 'Choices'}

<skipped many same line>

[2022-09-07 09:51:13,319] [label_studio_converter.converter::convert_to_yolo::627] [WARNING] Unknown label type or labels are empty: {'choices': ['NoPeople'], 'type': 'Choices'}
[2022-09-07 09:51:13,327] [core.utils.common::custom_exception_handler::82] [ERROR] 4a4366c2-8571-4935-aa00-1864a1534a80 [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/label-studio/label_studio/data_export/api.py", line 183, in get
    export_stream, content_type, filename = DataExport.generate_export_file(
  File "/label-studio/label_studio/data_export/models.py", line 173, in generate_export_file
    shutil.make_archive(tmp_dir, 'zip', tmp_dir)
  File "/usr/lib/python3.8/shutil.py", line 1032, in make_archive
    save_cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
[2022-09-07 09:51:13,369] [django.request::log_response::224] [ERROR] Internal Server Error: /api/projects/10/export
[07/Sep/2022 09:51:13] "GET /api/projects/10/export?exportType=YOLO HTTP/1.0" 500 927
makseq commented 2 years ago

@zbyte Could you please show your labeling config?

zbyte commented 2 years ago

`

`

zbyte commented 2 years ago

after restart docker containers, export stopped crash

makseq commented 2 years ago

@zbyte this could happen because of hard drive permissions.

So, does it mean that the export works stably and we can close this issue?

zbyte commented 2 years ago

No, now we have this error again. Nobody touch permissions or files/dirs on fs.

zbyte commented 2 years ago

traceback is same, same as last time, everything was fixed after container restart

zbyte commented 2 years ago

Logs, after container restart:

./deploy/docker-entrypoint.sh: Looking for init scripts in /label-studio/deploy/docker-entrypoint.d/
./deploy/docker-entrypoint.sh: Launching /label-studio/deploy/docker-entrypoint.d/10-copy-static-data.sh
=> Copy static data to a shared folder...
=> Successfully copied.
./deploy/docker-entrypoint.sh: Launching /label-studio/deploy/docker-entrypoint.d/20-wait-for-db.sh
=> Waiting for postgres...
=> Postgres is up.
./deploy/docker-entrypoint.sh: Launching /label-studio/deploy/docker-entrypoint.d/30-run-db-migrations.sh
=> Do database migrations...
=> Database and media directory: /label-studio/data
=> Static URL is set to: /static/
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /pypi/label-studio/json HTTP/1.1" 200 50436
No module named 'data_manager.actions.__pycache_'
Operations to perform:
  Apply all migrations: admin, auth, authtoken, contenttypes, data_export, data_import, data_manager, django_rq, io_storages, labels_manager, ml, organizations, projects, sessions, tasks, users, webhooks
Running migrations:
  No migrations to apply.
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
=> Migrations completed.
./deploy/docker-entrypoint.sh: Configuration complete; ready for start up
=> Database and media directory: /label-studio/data
=> Static URL is set to: /static/
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /pypi/label-studio/json HTTP/1.1" 200 50436
Performing system checks...

System check identified no issues (1 silenced).
September 12, 2022 - 10:49:21
Django version 3.1.14, using settings 'core.settings.label_studio'
Starting development server at http://0.0.0.0:8080/
AWoelfel commented 1 year ago

We face the exact same Error using LS v1.5.0 LS runs in docker

We have ~600 images worth around 1GByte to export.

Are there any news on this "Runtime error"?

EDIT :

Our deployment failes at the exact same position as mentioned by @zbyte

File "/usr/lib/python3.8/shutil.py", line 1032, in make_archive save_cwd = os.getcwd()

AWoelfel commented 1 year ago

After one night of sleep... @zbyte what version of docker do you use? mine is docker 20.10.12 atm

makseq commented 1 year ago

@AWoelfel @zbyte let's try to use a console export command (it should be available in LS 1.6): lhttps://labelstud.io/guide/export.html#Export-using-console-command