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

Distribution / lib files missing since 1.14.0

Open maerteijn opened this issue 1 year ago • 7 comments

Describe the bug Since the release of 1.14.0, the web/dist/libs/editor and web/dist/libs/datamanager directories in the releases are empty.

1.14.0: image

1.13.1: image

This is also to be seen in the file size of the archives which can be downloaded:

1.14.0: image

1.13.1: image

Is there a reason why all the lib assets are not shipped anymore with the release?

maerteijn avatar Dec 03 '24 12:12 maerteijn

Hi there!

Thanks for reporting this! After discussing this with our engineering team, they were interested in your usecase. These files were removed as part of a change to the infrastructure of the package, which ultimately reduced the package size by about 20MB, as we moved it into a monorepo approach. Can you describe what you were utilizing those files for?

Thanks,

Tyler Conlee Head of Support HumanSignal

Comment by Tyler Conlee Workflow Run

heidi-humansignal avatar Dec 09 '24 21:12 heidi-humansignal

Hi @heidi-humansignal,

Thank you for your message!

We use the stand alone editor in one of our projects, and we directly include these built assets from the lib/editor directory:

<html>
...
<script src="main.js"></script>
<link rel="stylesheet" href="main.css">
...
</html>

Then we can directly use the editor by using the following (as in the documentation) without any frontend building:

var labelStudio = new LabelStudio("editor", options);

I'd happy to know how this should be done now (and this might be useful to add in the documentation?)

maerteijn avatar Dec 11 '24 08:12 maerteijn

So after diving into the source code / project I managed to build a stand-alone version of the editor myself with the following command:

~/Dev/label-studio/web((1.14.0.post0))$ MODE=standalone npx nx run editor:build:production

I then needed to copy the following files:

- dist/libs/editor/715.js
- dist/libs/editor/743.js
- dist/libs/editor/main.js
- dist/libs/editor/main.css

And include the js as a module:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="./main.css">
</head>

<body>
    <div id="lsf"></div>
    <script type="module">
        const labelStudio = new LabelStudio("lsf", {...});
    </script>
    <script src="./main.js" type="module"></script>
</body>
</html>

So without the library files inside the package, is this the "new supposed way" to do it? I've seen the lsf:serve command in package.json is doing something similar for booting up a LSF standalone editor:

FRONTEND_HOSTNAME=http://localhost:3000 MODE=standalone nx run editor:serve:development

If this makes sense, could we add a lsf:build command to package.json so this is at least a sort of "known" command?

maerteijn avatar Dec 11 '24 21:12 maerteijn

Hi there!

I'll pass that feedback along to the team internally! Should our product team decide to move forward with your suggestion, we'll keep you informed of any updates. Please be aware that submitting a request does not ensure its implementation or a quick turnaround time. We appreciate your understanding and support.

Thanks,

Tyler Conlee Head of Support HumanSignal

Comment by Tyler Conlee Workflow Run

heidi-humansignal avatar Dec 20 '24 16:12 heidi-humansignal

This is also happening to me.

build from source using:

git clone https://github.com/HumanSignal/label-studio.git cd label-studio git checkout tags/1.17.0 -b label-studio-1.17.0

  • install dependencies pip install poetry poetry install

  • run db migrations poetry run python label_studio/manage.py migrate

  • collect static files poetry run python label_studio/manage.py collectstatic

  • start the server in development mode at http://localhost:8080 poetry run python label_studio/manage.py runserver

**After creating a file it shows **

[2025-04-24 21:46:35,356] [django.security.SuspiciousFileOperation::response_for_exception::124] [ERROR] The joined path (/631.js) is located outside of the base path component (/home/vitor/Documents/WIKKI/fossiles/label-studio/label-studio/label-studio/web/dist/apps/labelstudio) File "/home/vitor/Documents/WIKKI/fossiles/label-studio/label-studio/label-studio/label_studio/core/utils/static_serve.py", line 59, in serve fullpath = Path(safe_join(document_root, possible_asset)) File "/home/vitor/Documents/WIKKI/fossiles/label-studio/.venv/lib/python3.10/site-packages/django/utils/_os.py", line 31, in safe_join raise SuspiciousFileOperation( django.core.exceptions.SuspiciousFileOperation: The joined path (/631.js) is located outside of the base path component (/home/vitor/Documents/WIKKI/fossiles/label-studio/label-studio/label-studio/web/dist/apps/labelstudio)

vitorpmh avatar Apr 24 '25 21:04 vitorpmh

I exactly encountered the same error @vitorpmh, Can you explain how you solved it, if you did?

AlirezaSalehy avatar Jun 10 '25 10:06 AlirezaSalehy

I could not solve it. Just used the docker version.

vitorpmh avatar Jun 10 '25 10:06 vitorpmh

I get this error as well with main.js:

django.core.exceptions.SuspiciousFileOperation: The joined path (/main.js) is located outside of the base path component (/home/ubuntu/src/label-studio/web/dist/apps/labelstudio)
[2025-06-24 11:24:03,695] [django.security.SuspiciousFileOperation::response_for_exception::124] [ERROR] The joined path (/main.js) is located outside of the base path component (/home/ubuntu/src/label-studio/web/dist/apps/labelstudio)
Traceback (most recent call last):
  File "/home/ubuntu/miniforge3/envs/label-studio/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniforge3/envs/label-studio/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniforge3/envs/label-studio/lib/python3.11/site-packages/sentry_sdk/integrations/django/views.py", line 90, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/src/label-studio/label_studio/core/utils/static_serve.py", line 59, in serve
    fullpath = Path(safe_join(document_root, possible_asset))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniforge3/envs/label-studio/lib/python3.11/site-packages/django/utils/_os.py", line 31, in safe_join
    raise SuspiciousFileOperation(
django.core.exceptions.SuspiciousFileOperation: The joined path (/main.js) is located outside of the base path component (/home/ubuntu/src/label-studio/web/dist/apps/labelstudio)

after running label-studio locally with:

install dependencies
    pip install poetry
    poetry install

    run db migrations
    poetry run python label_studio/manage.py migrate

    collect static files
    poetry run python label_studio/manage.py collectstatic

    start the server in development mode at http://localhost:8080/
    poetry run python label_studio/manage.py runserver

poppingtonic avatar Jun 24 '25 11:06 poppingtonic

I have the same error exactly , do you @maerteijn @poppingtonic have resolved it ?

vwedqmp avatar Jul 30 '25 07:07 vwedqmp