Skip to content

Loading from local storage is bugged and/or doesn't match docs #1564

@ericchansen

Description

@ericchansen

Describe the Bug(s)

The documentation on using local storage isn't consistent between these two links.

For example, the environment variables mentioned in each are different. Also, note that neither of these pages describes what actually works (see below).

I'm trying to use local storage to label some files. Without working docs, I'm trying different things out and doing my best to get it working. Here are some iterations.

docker run -itd -p 8080:8080 -v /mnt/e/label-studio-backend-stuff:/label-studio/data --env LOCAL_FILES_SERVING_ENABLED=true --env LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/mnt/e/data -v /mnt/e/data:/label-studio/files heartexlabs/label-studio:latest

For anyone else struggling, note the env variables, which I think are correct in my example.

I then use the UI to add local storage. Here are two examples.

I use the absolute local path /mnt/e/data/example-data-dir-01, as described in https://labelstud.io/guide/storage.html#Local-storage.

image

I do some problem solving and try /label-studio/files-example-data-dir-01. I chose this because that's where the files are mounted in the Label Studio container.

I can add them.

image

But I can't sync them.

image

Here's the full stack trace.

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/io_storages/api.py", line 87, in post
    storage.sync()
  File "/label-studio/label_studio/io_storages/base_models.py", line 147, in sync
    self.scan_and_create_links()
  File "/label-studio/label_studio/io_storages/localfiles/models.py", line 84, in scan_and_create_links
    return self._scan_and_create_links(LocalFilesImportStorageLink)
  File "/label-studio/label_studio/io_storages/base_models.py", line 81, in _scan_and_create_links
    data = self.get_data(key)
  File "/label-studio/label_studio/io_storages/localfiles/models.py", line 68, in get_data
    relative_path = str(path.relative_to(document_root))
  File "/usr/lib/python3.8/pathlib.py", line 908, in relative_to
    raise ValueError("{!r} does not start with {!r}"
ValueError: '/label-studio/files/example-data-dir-01/image_0.jpg' does not start with '/mnt/e/data'

This command works, but it's nothing like what's in the Label Studio documentation.

docker run -itd -p 8080:8080 -v /mnt/e/label-studio-backend-stuff:/label-studio/data --env LOCAL_FILES_SERVING_ENABLED=true --env LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/files -v /mnt/e/data:/label-studio/files heartexlabs/label-studio:latest

Even with this working, whenever I go to add local storage as an option in Label Studio, it generates two entries.

image

When I try to delete the 2nd, unnecessary one (see below)...

image

... both get deleted (see below).

image

To Reproduce

See above.

Expected Behavior

I expect the docs to be consistent and correct. I also expect that I should relatively easily be able to mount local storage and label files from local storage.

Screenshots

None. Ask if you want screenshots.

Environment

I'm on Windows 11. Label Studio is running in WSL2. Label Studio should be the latest version because that's what Docker is grabbing.

Additional Context

None. Ask if you want any more details.

Metadata

Metadata

Labels

documentationImprovements or additions to documentationoften askedstoragesExternal / Cloud storage connections

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions