You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Suggests that you have multiple versions of MONAI installed? Try the running the command "pip list" and find out whether this is the case. If so consider uninstalling one version.
After installing dependencies with
MONAIVizLogic.installMONAI()
and then importing monai, I am getting the following errors.Slicer Version
The text was updated successfully, but these errors were encountered: