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: ModuleNotFoundError: No module named 'imp' #493

Closed
poing opened this issue Oct 12, 2023 · 4 comments
Closed

Python: ModuleNotFoundError: No module named 'imp' #493

poing opened this issue Oct 12, 2023 · 4 comments

Comments

@poing
Copy link

poing commented Oct 12, 2023

The imp module has been removed from Python 3.12.
python/cpython#98040

This breaks awsebcli when using python:latest in Docker.

$ eb use elastic-beanstalk
Traceback (most recent call last):
  File "/root/.local/bin/eb", line 5, in <module>
    from ebcli.core.ebcore import main
  File "/root/.local/lib/python3.12/site-packages/ebcli/core/ebcore.py", line 16, in <module>
    from cement.core import foundation, handler, hook
  File "/root/.local/lib/python3.12/site-packages/cement/core/foundation.py", line 11, in <module>
    from ..core import output, extension, arg, controller, meta, cache, mail
  File "/root/.local/lib/python3.12/site-packages/cement/core/extension.py", line 8, in <module>
    from imp import reload  # pragma: no cover
    ^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'imp'

Workaround

Use: python:3.11

@brianbraunstein
Copy link

brianbraunstein commented Jan 10, 2024

This is still happening with the currently available version at https://pypi.org/project/awsebcli/ 3.20.10 which was released on 2023.10.05, shortly before this issue was filed. Looks like "imp" was deprecated in 3.4 (https://docs.python.org/3.4/library/imp.html) released around 2014 (https://devguide.python.org/versions/), almost 10 years ago.

@rahulrajaram
Copy link
Collaborator

Thanks for reporting the bug. We're working on a fix for it.

@rahulrajaram
Copy link
Collaborator

I've fixed the issue upstream in cement: datafolklabs/cement#673. Will release new version of the EB CLI next week. To get around the issue until then install the EB CLI and run: pip install cement==2.10.14

rahulrajaram pushed a commit that referenced this issue Sep 12, 2024
This commit incorporates cement 2.10.14 that removes accesses to the
`imp` module in favour of `importlib` for 3.12. The EB CLI now
works for Python 3.12. One limitation is that Pytest 3 is not compatible
with Python 3.12 because of it's reliance on `imp` and [this
change](https://github.com/pytest-dev/pytest/blob/9515dfa58a144f3644fd29b256113d723c9c1955/src/_pytest/config/argparsing.py#L180)
not having been incorporated into Pytest 3.10.1 which hasn't see a new
release [since Nov 2018](https://pypi.org/project/pytest/3.10.1/). In
future work, we should upgrade Pytest to 8.x.

Issue: #493
@rahulrajaram
Copy link
Collaborator

Fixed in 3.21. Apologies for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants