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

RUNTIME ERROR - No module named 'cv2'

Open brunoaduarte opened this issue 7 months ago • 6 comments

Image

brunoaduarte avatar May 24 '25 02:05 brunoaduarte

which model are u running ? and on what platform are u running ur model .....

hsnaf avatar May 26 '25 03:05 hsnaf

Reinstall LS from scratch or try pip install -r requirements.txt

makseq avatar May 26 '25 15:05 makseq

i have same error with official docker image

zbyte avatar Jun 05 '25 13:06 zbyte

@zbyte could you please share logs from docker?

makseq avatar Jun 05 '25 13:06 makseq

Container version: 1.18.0

{"asctime": "05/Jun/2025:14:23:34 +0000", "name": "data_export.api", "funcName": "get", "lineno": 195, "levelname": "DEBUG", "user_id": null, "message": "Serialize tasks for export", "taskName": null, "request_id": null}
{"asctime": "05/Jun/2025:14:23:34 +0000", "name": "data_export.api", "funcName": "get", "lineno": 204, "levelname": "DEBUG", "user_id": null, "message": "Prepare export files", "taskName": null, "request_id": null}
{"asctime": "05/Jun/2025:14:23:35 +0000", "name": "core.utils.common", "funcName": "custom_exception_handler", "lineno": 98, "levelname": "ERROR", "user_id": null, "message": "3ddd1926-b61e-49d0-ada1-c3ad7ab682ad No module named 'cv2'", "exc_info": "Traceback (most recent call last):\n  File \"/label-studio/.venv/lib/python3.12/site-packages/rest_framework/views.py\", line 506, in dispatch\n    response = handler(request, *args, **kwargs)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/label-studio/.venv/lib/python3.12/site-packages/django/utils/decorators.py\", line 48, in _wrapper\n    return bound_method(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/label-studio/label_studio/data_export/api.py\", line 206, in get\n    export_file, content_type, filename = DataExport.generate_export_file(\n                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/label-studio/label_studio/data_export/models.py\", line 168, in generate_export_file\n    converter.convert(input_json, tmp_dir, output_format, is_dir=False)\n  File \"/label-studio/.venv/lib/python3.12/site-packages/label_studio_sdk/converter/converter.py\", line 310, in convert\n    from label_studio_sdk.converter.exports.brush_to_coco import convert_to_coco\n  File \"/label-studio/.venv/lib/python3.12/site-packages/label_studio_sdk/converter/exports/brush_to_coco.py\", line 11, in <module>\n    import cv2\nModuleNotFoundError: No module named 'cv2'", "taskName": null, "sentry_skip": false, "exception_id": "3ddd1926-b61e-49d0-ada1-c3ad7ab682ad", "request_id": null}
{"asctime": "05/Jun/2025:14:23:35 +0000", "name": "core.utils.common", "funcName": "custom_exception_handler", "lineno": 142, "levelname": "DEBUG", "user_id": null, "message": "Traceback (most recent call last):\n  File \"/label-studio/.venv/lib/python3.12/site-packages/rest_framework/views.py\", line 506, in dispatch\n    response = handler(request, *args, **kwargs)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/label-studio/.venv/lib/python3.12/site-packages/django/utils/decorators.py\", line 48, in _wrapper\n    return bound_method(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/label-studio/label_studio/data_export/api.py\", line 206, in get\n    export_file, content_type, filename = DataExport.generate_export_file(\n                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/label-studio/label_studio/data_export/models.py\", line 168, in generate_export_file\n    converter.convert(input_json, tmp_dir, output_format, is_dir=False)\n  File \"/label-studio/.venv/lib/python3.12/site-packages/label_studio_sdk/converter/converter.py\", line 310, in convert\n    from label_studio_sdk.converter.exports.brush_to_coco import convert_to_coco\n  File \"/label-studio/.venv/lib/python3.12/site-packages/label_studio_sdk/converter/exports/brush_to_coco.py\", line 11, in <module>\n    import cv2\nModuleNotFoundError: No module named 'cv2'\n", "taskName": null, "request_id": null}

zbyte avatar Jun 05 '25 15:06 zbyte

  1. Is it prebuilt docker image? Or you build it by yourself?
  2. Does it happen when you start LS? Or when you try exporting?

makseq avatar Jun 05 '25 17:06 makseq