label-studio icon indicating copy to clipboard operation
label-studio copied to clipboard

Runtime error in export to YOLO

Open zbyte opened this issue 2 years ago • 7 comments

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):

  • OS: docker
  • Label Studio Version 1.5.0.post0

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

zbyte avatar Sep 07 '22 09:09 zbyte

@zbyte Could you please show your labeling config?

makseq avatar Sep 09 '22 01:09 makseq

<View> <View style="display:flex;align-items:start;gap:8px;flex-direction:row"> <Image name="image" value="$image" maxWidth="100%" zoom="false" crosshair="true" zoomControl="false" rotateControl="false"/> <RectangleLabels name="label" toName="image" canRotate="false" showInline="false"> <Label value="People" background="#ff0000"/> <Label value="Head" background="#0080ff"/> </RectangleLabels> </View> <Choices name="choice" toName="image" choice="multiple" visibleWhen="no-region-selected" whenTagName="image"> <Choice value="NoPeople"/></Choices> </View>

zbyte avatar Sep 09 '22 10:09 zbyte

after restart docker containers, export stopped crash

zbyte avatar Sep 09 '22 10:09 zbyte

@zbyte this could happen because of hard drive permissions.

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

makseq avatar Sep 09 '22 17:09 makseq

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

zbyte avatar Sep 12 '22 10:09 zbyte

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

zbyte avatar Sep 12 '22 10:09 zbyte

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/

zbyte avatar Sep 12 '22 11:09 zbyte

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 avatar Sep 29 '22 15:09 AWoelfel

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

AWoelfel avatar Sep 30 '22 07:09 AWoelfel

@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

makseq avatar Sep 30 '22 12:09 makseq