Closed
Description
Describe the bug
MONAI does not work with Python 3.12 since it uses the deprecated (and now removed) find_module
API from importlib
. See Python release note.
To Reproduce
Python 3.12.0 | packaged by conda-forge | (main, Oct 3 2023, 08:36:57) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import monai
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/Caskroom/miniforge/base/envs/p312/lib/python3.12/site-packages/monai/__init__.py", line 58, in <module>
load_submodules(sys.modules[__name__], False, exclude_pattern=excludes)
File "/opt/homebrew/Caskroom/miniforge/base/envs/p312/lib/python3.12/site-packages/monai/utils/module.py", line 212, in load_submodules
importer.find_module(name).load_module(name) # type: ignore
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FileFinder' object has no attribute 'find_module'
Expected behavior
This was previously put on hold in #7096 due to torch not supporting 3.12. Since torch now has Python 3.12 support in v2.2.1, MONAI should work as well.
Metadata
Metadata
Assignees
Labels
No labels