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

after uploading additional images to project getting has_permission error when using api

Open iceisfun opened this issue 2 years ago • 3 comments

Describe the bug Have an existing data set, uploaded more images, labeled them and Exported to JSON

We have a script that downloads all data and trains it, we get this exception just for the new images uploaded, rest of the dataset downloads and trains as usual

[2022-08-14 01:52:06,140] [core.utils.common::custom_exception_handler::82] [ERROR] d859f6f8-6d0f-4ec6-b788-4afafc5a7f44 'NoneType' object has no attribute 'has_permission'
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 "/label-studio/label_studio/data_import/api.py", line 456, in get
    if not file_upload.has_permission(request.user):
AttributeError: 'NoneType' object has no attribute 'has_permission'
[2022-08-14 01:52:06,148] [django.request::log_response::224] [ERROR] Internal Server Error: /data/upload/93502c49-62f6cf5fb7dc44477adf0ded.jpeg

Environment (please complete the following information):

Recently we upgraded to docker image :latest

Additional context Add any other context about the problem here.

iceisfun avatar Aug 14 '22 01:08 iceisfun

Unfortunately you can't move uploaded data so easily to another from one project to another. I would recommend to use Local Storage for images: https://labelstud.io/guide/storage.html#Local-storage

makseq avatar Aug 16 '22 23:08 makseq

I have not moved anything between projects, just added new images to an existing project.

I can work with the new images, add labels and stuff

When I try to export I can't get them with the API.

I was able to extract them from disk and train, it seems like some kind of permissions issue when uploading new images its not initializing them or their properties?

iceisfun avatar Aug 31 '22 08:08 iceisfun

@iceisfun not sure it's a permission issue.. Maybe you have non-persistent storage in docker and all images are missed after docker restart?

I was able to extract them from disk

Do you mean your disk or LS disk?

makseq avatar Sep 09 '22 01:09 makseq

@makseq Would you please point out how to deal with the case of moving an entire project?

So, we have an instance of LS running that was using sqlite3. We had a few projects there. Now, we built another instance with docker and postgres.

I exported an entire project with LS json format with all the fields, then imported it to the new instance. I also copied the entire content of the media folder (contains upload & export). So the content (the images) is there.

However, I can see them. They don't load.

ktobah avatar Nov 03 '22 21:11 ktobah

@ktobah Please check the answer here: https://github.com/heartexlabs/label-studio/issues/3201#issuecomment-1304384789

makseq avatar Nov 05 '22 03:11 makseq

why is this even a constraint? why is it not allowed to drop more images in the folder?

govindrai avatar Oct 23 '23 00:10 govindrai