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

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

Closed
Hendrik-code opened this issue Feb 9, 2024 · 2 comments · Fixed by #7482
Closed
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@Hendrik-code
Copy link

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.

@KumoLiu KumoLiu added bug Something isn't working dependencies Pull requests that update a dependency file labels Feb 14, 2024
@ImranNust
Copy link

I am facing the same issue. Have you resolved it? Do I need to depreciate the python library to lower version?

@ImranNust
Copy link

I am facing the same issue. Have you resolved it? Do I need to depreciate the python library to lower version?

I just downgraded Python to 11* version and installed monai, and it worked!

KumoLiu added a commit to KumoLiu/MONAI that referenced this issue Feb 21, 2024
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
KumoLiu added a commit that referenced this issue Feb 21, 2024
Fixes #7458

### Description


https://github.com/python/cpython/blob/a21c0c7def9a8495f1166d9b434dfc301cb92bff/Lib/importlib/abc.py#L68

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
juampatronics pushed a commit to juampatronics/MONAI that referenced this issue Mar 25, 2024
Fixes Project-MONAI#7458

### Description

https://github.com/python/cpython/blob/a21c0c7def9a8495f1166d9b434dfc301cb92bff/Lib/importlib/abc.py#L68

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Signed-off-by: Juan Pablo de la Cruz Gutiérrez <juampatronics@gmail.com>
Yu0610 pushed a commit to Yu0610/MONAI that referenced this issue Apr 11, 2024
Fixes Project-MONAI#7458

### Description

https://github.com/python/cpython/blob/a21c0c7def9a8495f1166d9b434dfc301cb92bff/Lib/importlib/abc.py#L68

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Signed-off-by: Yu0610 <612410030@alum.ccu.edu.tw>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants