-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
After installing dependencies with MONAIVizLogic.installMONAI() and then importing monai, I am getting the following errors.
>>> import monai
Traceback (most recent call last):
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/utils/module.py", line 210, in load_submodules
mod = import_module(name)
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/apps/__init__.py", line 15, in <module>
from .mmars import MODEL_DESC, RemoteMMARKeys, download_mmar, get_model_spec, load_from_mmar
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/apps/mmars/__init__.py", line 14, in <module>
from .mmars import download_mmar, get_model_spec, load_from_mmar
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/apps/mmars/mmars.py", line 29, in <module>
import monai.networks.nets as monai_nets
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/networks/nets/__init__.py", line 101, in <module>
from .swin_unetr import PatchMerging, PatchMergingV2, SwinUNETR
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/networks/nets/swin_unetr.py", line 21, in <module>
import torch.utils.checkpoint as checkpoint
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/torch/utils/checkpoint.py", line 18, in <module>
from torch.testing._internal.logging_tensor import LoggingTensorMode, capture_logs
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/torch/testing/_internal/logging_tensor.py", line 2, in <module>
from torch.utils._pytree import tree_map
ImportError: cannot import name 'tree_map' from 'torch.utils._pytree' (/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/torch/utils/_pytree.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/__init__.py", line 58, in <module>
load_submodules(sys.modules[__name__], False, exclude_pattern=excludes)
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/utils/module.py", line 220, in load_submodules
raise type(e)(f"{e}\n{msg}").with_traceback(e.__traceback__) from e # raise with modified message
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/utils/module.py", line 210, in load_submodules
mod = import_module(name)
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/apps/__init__.py", line 15, in <module>
from .mmars import MODEL_DESC, RemoteMMARKeys, download_mmar, get_model_spec, load_from_mmar
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/apps/mmars/__init__.py", line 14, in <module>
from .mmars import download_mmar, get_model_spec, load_from_mmar
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/apps/mmars/mmars.py", line 29, in <module>
import monai.networks.nets as monai_nets
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/networks/nets/__init__.py", line 101, in <module>
from .swin_unetr import PatchMerging, PatchMergingV2, SwinUNETR
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/monai/networks/nets/swin_unetr.py", line 21, in <module>
import torch.utils.checkpoint as checkpoint
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/torch/utils/checkpoint.py", line 18, in <module>
from torch.testing._internal.logging_tensor import LoggingTensorMode, capture_logs
File "/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/torch/testing/_internal/logging_tensor.py", line 2, in <module>
from torch.utils._pytree import tree_map
ImportError: cannot import name 'tree_map' from 'torch.utils._pytree' (/Applications/Slicer-5.4.0_stable.app/Contents/lib/Python/lib/python3.9/site-packages/torch/utils/_pytree.py)
Multiple versions of MONAI may have been installed?
Please see the installation guide: https://docs.monai.io/en/stable/installation.html
Slicer Version
[DEBUG][Qt] 12.10.2023 11:07:20 [] (unknown:0) - Session start time .......: 2023-10-12 11:07:20
[DEBUG][Qt] 12.10.2023 11:07:20 [] (unknown:0) - Slicer version ...........: 5.4.0 (revision 31938 / 311cb26) macosx-amd64 - installed release
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - Operating system .........: macOS / 13.5 / 22G74 / UTF-8 - 64-bit
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - Memory ...................: 65536 MB physical, 0 MB virtual
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - CPU ......................: Apple M2 Max, 12 cores, 12 logical processors
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - VTK configuration ........: OpenGL2 rendering, Sequential threading
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - Qt configuration .........: version 5.15.8, with SSL, requested OpenGL 3.2 (core profile)
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - Internationalization .....: disabled, language=
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - Developer mode ...........: enabled
[DEBUG][Qt] 12.10.2023 11:07:21 [] (unknown:0) - Application path .........: /Applications/Slicer-5.4.0_stable.app/Contents/MacOS
Metadata
Metadata
Assignees
Labels
No labels