MONAILabel icon indicating copy to clipboard operation
MONAILabel copied to clipboard

ModuleNotFoundError: No module named 'pydicom._storage_sopclass_uids'

Open sunshineinsandiego opened this issue 7 months ago • 3 comments

Describe the bug Following the directions here: https://docs.monai.io/projects/label/en/latest/quickstart.html For Radiology Tutorial #1. I receive the following error:

ModuleNotFoundError: No module named 'pydicom._storage_sopclass_uids'

Server logs $ monailabel start_server --app apps/radiology --studies datasets/Task09_Spleen/imagesTr --conf models segmentation_spleen Using PYTHONPATH=/home/user:

In the future np.bool will be defined as the corresponding NumPy scalar. In the future np.bool will be defined as the corresponding NumPy scalar. In the future np.bool will be defined as the corresponding NumPy scalar. [2025-06-22 18:32:04,899] [9824] [MainThread] [INFO] (main:285) - USING:: version = False [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: app = /home/user/segmentation/apps/radiology [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: studies = /home/user/segmentation/datasets/Task09_Spleen/imagesTr [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: verbose = INFO [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: conf = [['models', 'segmentation_spleen']] [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: host = 0.0.0.0 [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: port = 8000 [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: uvicorn_app = monailabel.app:app [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: ssl_keyfile = None [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: ssl_certfile = None [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: ssl_keyfile_password = None [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: ssl_ca_certs = None [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: workers = None [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: limit_concurrency = None [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: access_log = False [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: root_path = [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: log_level = info [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: log_config = None [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: dryrun = False [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:285) - USING:: action = start_server [2025-06-22 18:32:04,900] [9824] [MainThread] [INFO] (main:296) - [2025-06-22 18:32:05,151] [9824] [MainThread] [WARNING] (pydicom:82) - get_frame_offsets is deprecated and will be removed in v4.0 Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/user/.local/lib/python3.10/site-packages/monailabel/main.py", line 356, in Main().run() File "/home/user/.local/lib/python3.10/site-packages/monailabel/main.py", line 135, in run self.action_start_server(args) File "/home/user/.local/lib/python3.10/site-packages/monailabel/main.py", line 242, in action_start_server uvicorn.run( File "/home/user/.local/lib/python3.10/site-packages/uvicorn/main.py", line 580, in run server.run() File "/home/user/.local/lib/python3.10/site-packages/uvicorn/server.py", line 66, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/user/.local/lib/python3.10/site-packages/uvicorn/server.py", line 70, in serve await self._serve(sockets) File "/home/user/.local/lib/python3.10/site-packages/uvicorn/server.py", line 77, in _serve config.load() File "/home/user/.local/lib/python3.10/site-packages/uvicorn/config.py", line 435, in load self.loaded_app = import_from_string(self.app) File "/home/user/.local/lib/python3.10/site-packages/uvicorn/importer.py", line 22, in import_from_string raise exc from None File "/home/user/.local/lib/python3.10/site-packages/uvicorn/importer.py", line 19, in import_from_string module = importlib.import_module(module_str) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/user/.local/lib/python3.10/site-packages/monailabel/app.py", line 24, in from monailabel.endpoints import ( File "/home/user/.local/lib/python3.10/site-packages/monailabel/endpoints/activelearning.py", line 20, in from monailabel.interfaces.app import MONAILabelApp File "/home/user/.local/lib/python3.10/site-packages/monailabel/interfaces/app.py", line 37, in from monailabel.datastore.dicom import DICOMwebClientX, DICOMWebDatastore File "/home/user/.local/lib/python3.10/site-packages/monailabel/datastore/dicom.py", line 25, in from monailabel.datastore.utils.convert import binary_to_image, dicom_to_nifti, nifti_to_dicom_seg File "/home/user/.local/lib/python3.10/site-packages/monailabel/datastore/utils/convert.py", line 21, in import pydicom_seg File "/home/user/.local/lib/python3.10/site-packages/pydicom_seg/init.py", line 4, in from pydicom_seg.reader import MultiClassReader, SegmentReader File "/home/user/.local/lib/python3.10/site-packages/pydicom_seg/reader.py", line 9, in from pydicom._storage_sopclass_uids import SegmentationStorage ModuleNotFoundError: No module named 'pydicom._storage_sopclass_uids'

To Reproduce Steps to reproduce the behavior:

install MONAI Label

pip install monailabel

download Radiology sample app to local directory

monailabel apps --name radiology --download --output .

download Task 2 MSD dataset

monailabel datasets --download --name Task09_Spleen --output .

start the Radiology app in MONAI label server

and start annotating the downloaded images using deepedit model

monailabel start_server --app radiology --studies Task09_Spleen/imagesTr --conf models deepedit

Expected behavior Successful start of MonaiLabel

Environment

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

python -c 'import monai; monai.config.print_debug_info()'

=============================== Printing MONAI config...

MONAI version: 1.5.0 Numpy version: 1.26.4 Pytorch version: 2.6.0+cu124 MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False MONAI rev id: d388d1c6fec8cb3a0eebee5b5a0b9776ca59ca83 MONAI file: /home//.local/lib/python3.10/site-packages/monai/init.py

Optional dependencies: In the future np.bool will be defined as the corresponding NumPy scalar. Pytorch Ignite version: 0.4.11 ITK version: NOT INSTALLED or UNKNOWN VERSION. Nibabel version: 5.3.2 scikit-image version: 0.25.2 scipy version: 1.15.3 Pillow version: 11.2.1 Tensorboard version: 2.19.0 gdown version: 5.2.0 TorchVision version: 0.21.0+cu124 tqdm version: 4.67.1 lmdb version: 1.6.2 psutil version: 7.0.0 pandas version: 2.3.0 einops version: 0.8.1 transformers version: NOT INSTALLED or UNKNOWN VERSION. mlflow version: 3.1.0 pynrrd version: 1.1.3 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: Linux Linux version: Ubuntu 22.04.5 LTS Platform: Linux-6.8.0-1030-gcp-x86_64-with-glibc2.35 Processor: x86_64 Machine: x86_64 Python version: 3.10.12 Process name: python Command: ['python', '-c', 'import monai; monai.config.print_debug_info()'] Open files: [] Num physical CPUs: 4 Num logical CPUs: 8 Num usable CPUs: 8 CPU usage (%): [5.2, 5.2, 4.8, 5.2, 5.2, 5.2, 4.8, 100.0] CPU freq. (MHz): 2300 Load avg. in last 1, 5, 15 mins (%): [1.0, 0.6, 0.8] Disk usage (%): 3.9 Avg. sensor temp. (Celsius): UNKNOWN for given OS Total physical memory (GB): 51.0 Available memory (GB): 49.5 Used memory (GB): 0.9

================================ Printing GPU config...

Num GPUs: 1 Has CUDA: True CUDA version: 12.4 cuDNN enabled: True NVIDIA_TF32_OVERRIDE: None TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None cuDNN version: 90100 Current device: 0 Library compiled for CUDA architectures: ['sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_90'] GPU 0 Name: Tesla T4 GPU 0 Is integrated: False GPU 0 Is multi GPU board: False GPU 0 Multi processor count: 40 GPU 0 Total memory (GB): 14.6 GPU 0 CUDA capability (maj.min): 7.5

sunshineinsandiego avatar Jun 22 '25 18:06 sunshineinsandiego

Also running into this bug.

MONAI version: 1.5.0
Numpy version: 1.26.4
Pytorch version: 2.6.0+cpu
MONAI Flags: HAS EXT = False, USE COMPILED = False, USE META DICT = False
MONAI rev id: d388d1c6fec8cb3a0eebee5b5a0b9776ca59ca83
MONAI File: C:\Users\<username>\Desktop\monai\venv\Lib\site-packages\wonal\_init...py
Optional dependencies:
Pytorch Ignite version: 6.4.11
ITK version: 5.4.4
Nibabel version: 5.3.2
scikit-image version: 6.25.2
scipy version: 1.16.0
Pillow version: 11.2.1
Tensorboard version: 2.19.0
gdown version: 5.2.0
TorchVision version: 0.21.0+cpu
tqdm version: 4.67.1
lmdb version: 1.6.2
psutil version: 7.0.0
pandas version: 2.3.0
einops version: 0.8.1
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: 3.1.0
pynrrd version: 1.1.3
clearml version: NOT INSTALLED or UNKNOWN VERSION.

Printing system config...

System: Windows
Win32 version: ('11', '10.0.26100', 'SPO', 'Multiprocessor Free')
Win32 edition: Professional
Platform: Windows-11-10.0.26100-SP0
Processor: Intel64 Family 6 Model 85 Stepping 4, GenuineIntel
Machine: AMD64
Python version: 3.12.10
Process name: python.exe Command: ['C:\\Users\\Admin\\.pyenv\\pyenv-win\\versions\13.12.10\\python.exe", 'c', 'import monai; monai.config.print_debug_info()']
Open files: (popenfile(path='C:\\Windows\\System32\\en-US\\tzres.dll.mut', fd=-1), popenfile(pathe 'C:\\Windows\\System32
\\en-US\\KernelBase.dll.mui, fd=-1)]
Num physical CPUs: 10 Nun Logical CPUs: 20
Num usable CPUs: 20
CPU usage (%): [16.0, 3.7, 30.9, 0.7, 12.3, 5.5, 6.3, 5.3, 9.7, 5.8, 8.6, 8.9, 9.0, 4.0, 7.0, 4.2, 14.7, 4.7, 7.0, 35.0]
CPU Freq. (MHz): 3504
Load avg. in last 1, 5, 15 mins (%): [0.0, 0.0, 0.0]
Disk usage (%): 53.2
Avg. sensor temp. (Celsius): UNKNOWN fer given OS
Total physical memory (GB): 255.7
Available memory (GB): 239.9
Used memory (GB): 15.8
Printing GPU config.
Num GPUs:
Has CUDA: False
cuDNN enabled: False
NVIDIA TF32 OVERRIDE: None
TORCH ALLOW TF32_CUBLAS_OVERRIDE: None

Modjular avatar Jun 24 '25 23:06 Modjular

Try replacing from pydicom._storage_sopclass_uids import SegmentationStorage with from pydicom.uid import SegmentationStorage in segmentation_dataset.py and reader.py within \Lib\site-packages\pydicom_seg. Refer to https://github.com/razorx89/pydicom-seg/issues/60 for more information.

BLQNXAY avatar Jul 20 '25 13:07 BLQNXAY

I can confirm that suggestion by BLQNXAY eliminated this particular problem for me.

gthaker avatar Jul 31 '25 18:07 gthaker