aws / aws-elastic-beanstalk-cli

The EB CLI is a command line interface for Elastic Beanstalk that provides interactive commands that simplify creating, updating and monitoring environments from a local repository.
Apache License 2.0
161 stars 78 forks source link

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

Closed poing closed 1 month ago

poing commented 1 year ago

The imp module has been removed from Python 3.12.
https://github.com/python/cpython/issues/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 commented 9 months ago

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 commented 9 months ago

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

rahulrajaram commented 8 months ago

I've fixed the issue upstream in cement: https://github.com/datafolklabs/cement/pull/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 commented 1 month ago

Fixed in 3.21. Apologies for the delay.