Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'AddChanneld' from 'monai.transforms' #1571

Open
QianMuXiao opened this issue Oct 14, 2023 · 4 comments
Open

Comments

@QianMuXiao
Copy link

Please use MONAILabel's Discussions tab
For questions relating to MONAILabel usage, please do not create an issue.

Instead, use MONAI's GitHub Discussions tab. This can be found next to Issues and Pull Requests along the top of our repository.

My Trackback as follow:

(FUXIAN) PS C:\Users\xiaoqianmu> monailabel start_server --app apps/radiology --studies datasets/Task09_Spleen/imagesTr --conf models Using PYTHONPATH=C:\Anaconda\envs;
""
[2023-10-14 09:35:43,470] [4720] [MainThread] [INFO] (main:285) - USING:: version = False
[2023-10-14 09:35:43,470] [4720] [MainThread] [INFO] (main:285) - USING:: app = C:\Users\xiaoqianmu\apps\radiology
[2023-10-14 09:35:43,470] [4720] [MainThread] [INFO] (main:285) - USING:: studies = C:\Users\xiaoqianmu\datasets\Task09_Spleen\imagesTr
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: verbose = INFO
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: conf = [['models', 'deepedit']]
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: host = 0.0.0.0
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: port = 8000
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: uvicorn_app = monailabel.app:app
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: ssl_keyfile = None
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: ssl_certfile = None
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: ssl_keyfile_password = None
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: ssl_ca_certs = None
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: workers = None
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: limit_concurrency = None
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: access_log = False
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: root_path = /
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: log_level = info
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: log_config = None
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: dryrun = False
[2023-10-14 09:35:43,471] [4720] [MainThread] [INFO] (main:285) - USING:: action = start_server
[2023-10-14 09:35:43,472] [4720] [MainThread] [INFO] (main:296) -
Allow Origins: ['*']
[2023-10-14 09:35:44,305] [4720] [MainThread] [INFO] (uvicorn.error:74) - Started server process [4720]
[2023-10-14 09:35:44,306] [4720] [MainThread] [INFO] (uvicorn.error:48) - Waiting for application startup.
[2023-10-14 09:35:44,306] [4720] [MainThread] [INFO] (monailabel.interfaces.utils.app:37) - Initializing App from: C:\Users\xiaoqianmu\apps\radiology; studies: C:\Users\xiaoqianmu\datasets\Task09_Spleen\imagesTr; conf: {'models': 'deepedit'}
[2023-10-14 09:35:44,342] [4720] [MainThread] [ERROR] (uvicorn.error:123) - Traceback (most recent call last):
File "C:\Anaconda\envs\FUXIAN\lib\site-packages\starlette\routing.py", line 677, in lifespan
async with self.lifespan_context(app) as maybe_state:
File "C:\Anaconda\envs\FUXIAN\lib\site-packages\starlette\routing.py", line 566, in aenter
await self.router.startup()
File "C:\Anaconda\envs\FUXIAN\lib\site-packages\starlette\routing.py", line 654, in startup
await handler()
File "C:\Anaconda\envs\FUXIAN\lib\site-packages\monailabel\app.py", line 108, in startup_event
instance = app_instance()
File "C:\Anaconda\envs\FUXIAN\lib\site-packages\monailabel\interfaces\utils\app.py", line 43, in app_instance
c = get_class_of_subclass_from_file("main", main_py, "MONAILabelApp")
File "C:\Anaconda\envs\FUXIAN\lib\site-packages\monailabel\utils\others\class_utils.py", line 75, in get_class_of_subclass_from_file
File "C:\Anaconda\envs\FUXIAN\lib\site-packages\monailabel\utils\others\class_utils.py", line 45, in module_from_file
spec.loader.exec_module(module)
File "", line 843, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\xiaoqianmu\apps\radiology\main.py", line 19, in
from lib.infers.deepgrow_pipeline import InferDeepgrowPipeline
File "C:\Users\xiaoqianmu\apps\radiology\lib\infers_init
.py", line 13, in
from .deepgrow import Deepgrow
File "C:\Users\xiaoqianmu\apps\radiology\lib\infers\deepgrow.py", line 23, in
from monai.transforms import (
ImportError: cannot import name 'AddChanneld' from 'monai.transforms' (C:\Anaconda\envs\FUXIAN\lib\site-packages\monai\transforms_init
.py)

[2023-10-14 09:35:44,342] [4720] [MainThread] [ERROR] (uvicorn.error:59) - Application startup failed. Exiting.

@SachidanandAlle
Copy link
Collaborator

We are due to release next version of MONAI Label.. Until then you possibly have to downgrade the monai version to 1.12 or less

@QianMuXiao
Copy link
Author

Thx I have solved this problem by install monai==1.2.0

@lhssu
Copy link

lhssu commented Oct 16, 2023

yeah i got the same problem

@diazandr3s
Copy link
Collaborator

We are working on the latest version: 0.8.0.
In the meantime, please use the latest release candidate: https://pypi.org/project/monailabel/0.8.0rc1/

Just tested and it works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants