Project-MONAI / MONAILabel

MONAI Label is an intelligent open source image labeling and learning tool.
https://docs.monai.io/projects/label
Apache License 2.0
565 stars 185 forks source link

Failed to upload volume to Server. Message:: Status: 500; Response: Internal Server Error #1663

Open bz1977 opened 3 months ago

bz1977 commented 3 months ago

Describe the bug Failed to upload volume to Server. Message:: Status: 500; Response: Internal Server Error

Server logs ..+.+...+........+.........+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++..+...+........+.......+.....+...+....+........+......+.+........+.+..+...+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++........+.........+......+......+.+..+.......+...+..+.+.....+...+......+....+..+.......+..+....+.....+....+............+...+.....+.+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...+...+.+..+.........+.+..+...+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+.....+...+.......+......+.....+....+...+...+..+...+....+...+..+.+.....+.......+..+...+.+..+............+.+.....+.......+..+.+...........+....+......+........+......+.+..................+..+......+...................+........+.+..+..........+...+.........+..+.........+.......+..+.+..+.......+...+........+.+...+..+.........+..........+...........+....+.....+....+......+.....+....+......+...........+......+.......+.....+...+...+.......+.....+..........+.........+...+..+...+...+......................+..+...+.+......+......+...+..............+...+...+....+..+.........+....+..+.+...+.........+..+...+...+.............+......+........................+.....+.........+...+......................+..+.+...+..............+.+..+....+......+..+...+.............+.....+.........+.......+...+...+.....+.............+............+.....+....+...+......+............+.....+...+......+...+.+......+......+..+......+.+.....+...+.......+...+..+...............+...............+....+..+...+....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.

Country Name (2 letter code) [AU]: State or Province Name (full name) [Some-State]: Locality Name (eg, city) []: Organization Name (eg, company) [Internet Widgits Pty Ltd]: Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []: Email Address []: Using PYTHONPATH=C:\Users\bz197\anaconda3\envs; "" [2024-03-28 09:26:42,713] [13068] [MainThread] [INFO] (main:285) - USING:: version = False [2024-03-28 09:26:42,713] [13068] [MainThread] [INFO] (main:285) - USING:: app = C:\Users\bz197\MONAILabel\apps\radiology [2024-03-28 09:26:42,713] [13068] [MainThread] [INFO] (main:285) - USING:: studies = C:\Users\bz197\MONAILabel\datasets\Task09_Spleen\imagesTr [2024-03-28 09:26:42,714] [13068] [MainThread] [INFO] (main:285) - USING:: verbose = INFO [2024-03-28 09:26:42,714] [13068] [MainThread] [INFO] (main:285) - USING:: conf = [['models', 'deepedit']] [2024-03-28 09:26:42,714] [13068] [MainThread] [INFO] (main:285) - USING:: host = 0.0.0.0 [2024-03-28 09:26:42,714] [13068] [MainThread] [INFO] (main:285) - USING:: port = 8000 [2024-03-28 09:26:42,715] [13068] [MainThread] [INFO] (main:285) - USING:: uvicorn_app = monailabel.app:app [2024-03-28 09:26:42,715] [13068] [MainThread] [INFO] (main:285) - USING:: ssl_keyfile = uvicorn-selfsigned.key [2024-03-28 09:26:42,715] [13068] [MainThread] [INFO] (main:285) - USING:: ssl_certfile = uvicorn-selfsigned.crt [2024-03-28 09:26:42,716] [13068] [MainThread] [INFO] (main:285) - USING:: ssl_keyfile_password = None [2024-03-28 09:26:42,716] [13068] [MainThread] [INFO] (main:285) - USING:: ssl_ca_certs = None [2024-03-28 09:26:42,716] [13068] [MainThread] [INFO] (main:285) - USING:: workers = None [2024-03-28 09:26:42,716] [13068] [MainThread] [INFO] (main:285) - USING:: limit_concurrency = None [2024-03-28 09:26:42,717] [13068] [MainThread] [INFO] (main:285) - USING:: access_log = False [2024-03-28 09:26:42,717] [13068] [MainThread] [INFO] (main:285) - USING:: root_path = / [2024-03-28 09:26:42,717] [13068] [MainThread] [INFO] (main:285) - USING:: log_level = info [2024-03-28 09:26:42,717] [13068] [MainThread] [INFO] (main:285) - USING:: log_config = None [2024-03-28 09:26:42,718] [13068] [MainThread] [INFO] (main:285) - USING:: dryrun = False [2024-03-28 09:26:42,718] [13068] [MainThread] [INFO] (main:285) - USING:: action = start_server [2024-03-28 09:26:42,718] [13068] [MainThread] [INFO] (main:296) - Allow Origins: [''] [2024-03-28 09:26:43,539] [13068] [MainThread] [INFO] (uvicorn.error:74) - Started server process [13068] [2024-03-28 09:26:43,540] [13068] [MainThread] [INFO] (uvicorn.error:48) - Waiting for application startup. [2024-03-28 09:26:43,540] [13068] [MainThread] [INFO] (monailabel.interfaces.utils.app:37) - Initializing App from: C:\Users\bz197\MONAILabel\apps\radiology; studies: C:\Users\bz197\MONAILabel\datasets\Task09_Spleen\imagesTr; conf: {'models': 'deepedit'} [2024-03-28 09:26:43,598] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for MONAILabelApp Found: <class 'main.MyApp'> [2024-03-28 09:26:43,612] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.deepedit.DeepEdit'> [2024-03-28 09:26:43,613] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.deepgrow_2d.Deepgrow2D'> [2024-03-28 09:26:43,614] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.deepgrow_3d.Deepgrow3D'> [2024-03-28 09:26:43,615] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.localization_spine.LocalizationSpine'> [2024-03-28 09:26:43,616] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.localization_vertebra.LocalizationVertebra'> [2024-03-28 09:26:43,618] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.segmentation.Segmentation'> [2024-03-28 09:26:43,619] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.segmentation_spleen.SegmentationSpleen'> [2024-03-28 09:26:43,620] [13068] [MainThread] [INFO] (monailabel.utils.others.class_utils:57) - Subclass for TaskConfig Found: <class 'lib.configs.segmentation_vertebra.SegmentationVertebra'> [2024-03-28 09:26:43,620] [13068] [MainThread] [INFO] (main:93) - +++ Adding Model: deepedit => lib.configs.deepedit.DeepEdit [2024-03-28 09:26:44,326] [13068] [MainThread] [INFO] (lib.configs.deepedit:141) - EPISTEMIC Enabled: False; Samples: 5 [2024-03-28 09:26:44,326] [13068] [MainThread] [INFO] (main:96) - +++ Using Models: ['deepedit'] [2024-03-28 09:26:44,327] [13068] [MainThread] [INFO] (monailabel.interfaces.app:135) - Init Datastore for: C:\Users\bz197\MONAILabel\datasets\Task09_Spleen\imagesTr [2024-03-28 09:26:44,327] [13068] [MainThread] [INFO] (monailabel.datastore.local:130) - Auto Reload: True; Extensions: ['.nii.gz', '.nii', '.nrrd', '.jpg', '.png', '.tif', '.svs', '*.xml'] [2024-03-28 09:26:44,349] [13068] [MainThread] [INFO] (monailabel.datastore.local:577) - Invalidate count: 0 [2024-03-28 09:26:44,349] [13068] [MainThread] [INFO] (monailabel.datastore.local:151) - Start observing external modifications on datastore (AUTO RELOAD) [2024-03-28 09:26:44,353] [13068] [MainThread] [INFO] (main:126) - +++ Adding Inferer:: deepedit => <lib.infers.deepedit.DeepEdit object at 0x000001A0480DCC40> [2024-03-28 09:26:44,354] [13068] [MainThread] [INFO] (main:126) - +++ Adding Inferer:: deepedit_seg => <lib.infers.deepedit.DeepEdit object at 0x000001A04825E610> [2024-03-28 09:26:44,354] [13068] [MainThread] [INFO] (main:191) - {'deepedit': <lib.infers.deepedit.DeepEdit object at 0x000001A0480DCC40>, 'deepedit_seg': <lib.infers.deepedit.DeepEdit object at 0x000001A04825E610>, 'Histogram+GraphCut': <monailabel.scribbles.infer.HistogramBasedGraphCut object at 0x000001A0481ADE50>, 'GMM+GraphCut': <monailabel.scribbles.infer.GMMBasedGraphCut object at 0x000001A04831C3A0>} [2024-03-28 09:26:44,355] [13068] [MainThread] [INFO] (main:206) - +++ Adding Trainer:: deepedit => <lib.trainers.deepedit.DeepEdit object at 0x000001A04831C4C0> [2024-03-28 09:26:44,355] [13068] [MainThread] [INFO] (monailabel.utils.sessions:51) - Session Path: C:\Users\bz197.cache\monailabel\sessions [2024-03-28 09:26:44,355] [13068] [MainThread] [INFO] (monailabel.utils.sessions:52) - Session Expiry (max): 3600 [2024-03-28 09:26:44,356] [13068] [MainThread] [INFO] (monailabel.interfaces.app:469) - App Init - completed [2024-03-28 09:26:44,356] [timeloop] [INFO] Starting Timeloop.. [2024-03-28 09:26:44,356] [13068] [MainThread] [INFO] (timeloop:60) - Starting Timeloop.. [2024-03-28 09:26:44,357] [timeloop] [INFO] Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x000001A04814B4C0> [2024-03-28 09:26:44,357] [13068] [MainThread] [INFO] (timeloop:42) - Registered job <function MONAILabelApp.on_init_complete..run_scheduler at 0x000001A04814B4C0> [2024-03-28 09:26:44,358] [timeloop] [INFO] Timeloop now started. Jobs will run based on the interval set [2024-03-28 09:26:44,358] [13068] [MainThread] [INFO] (timeloop:63) - Timeloop now started. Jobs will run based on the interval set [2024-03-28 09:26:44,358] [13068] [MainThread] [INFO] (uvicorn.error:62) - Application startup complete. [2024-03-28 09:26:44,359] [13068] [MainThread] [INFO] (uvicorn.error:217) - Uvicorn running on https://0.0.0.0:8000 (Press CTRL+C to quit) [2024-03-28 09:27:24,851] [13068] [MainThread] [INFO] (monailabel.endpoints.datastore:68) - Image: 3: Abdomen +C 3.00 Br40; File: <starlette.datastructures.UploadFile object at 0x000001A048340310>; params: {"client_id": "user-xyz"} [2024-03-28 09:27:24,911] [13068] [MainThread] [INFO] (monailabel.datastore.local:439) - Adding Image: 3: Abdomen +C 3.00 Br40 => C:\Users\bz197\AppData\Local\Temp\tmpd9ju61ai.nii.gz [2024-03-28 09:27:24,924] [13068] [MainThread] [ERROR] (uvicorn.error:434) - Exception in ASGI application Traceback (most recent call last): File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 429, in run_asgi result = await app( # type: ignore[func-returns-value] File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in call return await self.app(scope, receive, send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\fastapi\applications.py", line 276, in call await super().call(scope, receive, send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\middleware\errors.py", line 184, in call raise exc File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\middleware\cors.py", line 84, in call await self.app(scope, receive, send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\middleware\exceptions.py", line 79, in call raise exc File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\middleware\exceptions.py", line 68, in call await self.app(scope, receive, sender) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call raise e File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\routing.py", line 718, in call await route.handle(scope, receive, send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\routing.py", line 276, in handle await self.app(scope, receive, send) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\starlette\routing.py", line 66, in app response = await func(request) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\fastapi\routing.py", line 237, in app raw_response = await run_endpoint_function( File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function return await dependant.call(**values) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\monailabel\endpoints\datastore.py", line 216, in api_add_image return add_image(background_tasks, image, params, file, user.username) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\monailabel\endpoints\datastore.py", line 82, in add_image image_id = instance.datastore().add_image(image_id, image_file, save_params) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\site-packages\monailabel\datastore\local.py", line 445, in add_image shutil.copy(image_filename, dest) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\shutil.py", line 427, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "C:\Users\bz197\anaconda3\envs\monailabel_env\lib\shutil.py", line 266, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '3: Abdomen +C 3.00 Br40.nii.gz'

Expected behavior It doesn't suppose to show error when uploading the label

Screenshots error500

Environment

Ensuring you use the relevant python executable, please paste the output of:

(monailabel_env) c:\Users\bz197\MONAILabel>python -c "import monai; monai.config.print_debug_info()"
================================
Printing MONAI config...
================================
MONAI version: 1.3.0
Numpy version: 1.26.4
Pytorch version: 2.2.1+cpu
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 865972f7a791bf7b42efbcd87c8402bd865b329e
MONAI __file__: C:\Users\<username>\anaconda3\envs\monailabel_env\lib\site-packages\monai\__init__.py

Optional dependencies:
Pytorch Ignite version: 0.4.11
ITK version: 5.3.0
Nibabel version: 5.2.1
scikit-image version: 0.22.0
scipy version: 1.12.0
Pillow version: 10.2.0
Tensorboard version: 2.16.2
gdown version: 4.7.3
TorchVision version: 0.17.1+cpu
tqdm version: 4.66.2
lmdb version: 1.4.1
psutil version: 5.9.8
pandas version: 2.2.1
einops version: 0.7.0
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: 2.11.3
pynrrd version: 1.0.0
clearml version: NOT INSTALLED or UNKNOWN VERSION.

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies

================================
Printing system config...
================================
System: Windows
Win32 version: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Win32 edition: Professional
Platform: Windows-10-10.0.19045-SP0
Processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
Machine: AMD64
Python version: 3.9.19
Process name: python.exe
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Open files: [popenfile(path='C:\\Windows\\System32\\en-US\\KernelBase.dll.mui', fd=-1), popenfile(path='C:\\Windows\\System32\\en-US\\tzres.dll.mui', fd=-1), popenfile(path='C:\\Windows\\System32\\en-US\\kernel32.dll.mui', fd=-1)]
Num physical CPUs: 4
Num logical CPUs: 8
Num usable CPUs: 8
CPU usage (%): [8.0, 1.5, 2.1, 0.6, 6.1, 2.7, 1.2, 78.3]
CPU freq. (MHz): 3601
Load avg. in last 1, 5, 15 mins (%): [0.0, 0.0, 0.0]
Disk usage (%): 53.7
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 15.9
Available memory (GB): 7.2
Used memory (GB): 8.7

================================
Printing GPU config...
================================
Num GPUs: 0
Has CUDA: False
cuDNN enabled: False
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None

Additional context Add any other context about the problem here.

diazandr3s commented 3 months ago

Hi,

Is the volume part of the datastore? can you see it in the dataset folder?

From the logs:

FileNotFoundError: [Errno 2] No such file or directory: '3: Abdomen +C 3.00 Br40.nii.gz'

It seems the system didn't find the volume associate with the label you wanted to upload.

lassoan commented 3 months ago

Filename had to be sanitized (you cannot have : in the filename).

bz1977 commented 3 months ago

The file does not exist anymore

On Mon, Apr 1, 2024 at 3:15 PM Andres Diaz-Pinto @.***> wrote:

Hi,

Is the volume part of the datastore? can you see it in the dataset folder?

From the logs:

FileNotFoundError: [Errno 2] No such file or directory: '3: Abdomen +C 3.00 Br40.nii.gz'

It seems the system didn't find the volume associate with the label you wanted to upload.

— Reply to this email directly, view it on GitHub https://github.com/Project-MONAI/MONAILabel/issues/1663#issuecomment-2029668463, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPKPBCO6RWGMKHW3UQXB43Y3FFXLAVCNFSM6AAAAABFMI3CZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGY3DQNBWGM . You are receiving this because you authored the thread.Message ID: @.***>

bz1977 commented 3 months ago

I know that, but the file does not exist anymore

On Mon, Apr 1, 2024 at 8:37 PM Andras Lasso @.***> wrote:

Filename had to be sanitized (you cannot have : in the filename).

— Reply to this email directly, view it on GitHub https://github.com/Project-MONAI/MONAILabel/issues/1663#issuecomment-2030222256, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPKPBDF656PK2IY4K6FS5LY3GLNXAVCNFSM6AAAAABFMI3CZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZQGIZDEMRVGY . You are receiving this because you authored the thread.Message ID: @.***>