Skip to content

Python 3.12 import AttributeError: 'FileFinder' object has no attribute 'find_module' #7458

Closed
@Hendrik-code

Description

@Hendrik-code

Describe the bug
When installing monai (via pip) into a conda environment of python 3.12.1, I get a
"
AttributeError: 'FileFinder' object has no attribute 'find_module'
"
as soon as i call "import monai"

To Reproduce
Steps to reproduce the behavior:

  1. conda create --name test python=3.12
  2. conda activate test
  3. pip install monai
  4. python
  5. import monai
    -> see screenshot below

Expected behavior
I should be able to import monai

Screenshots
installing monai triggered a lot of other package installations:
Screenshot from 2024-02-09 13-06-58

Screenshot from 2024-02-09 13-03-27

Environment

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

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

Well, the import statement crashes, so this info cannot be given.

Additional context
I am pretty sure it has to do with "find_module" being deprecated in python 3.12, as well as the "load_module" function in monai.utils.module.py (line 210 and following). Probably needs to be replaced with the 3.12 version of those function calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesPull requests that update a dependency file

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions