pythonamazon-web-servicesamazon-elastic-beanstalk

ModuleNotFoundError: No module named 'imp'


I need to install the eb command on windows.

I would like to try to deploy an application on AWS using the elasticbeanstalk service, and through this command you can configure and deploy an environment directly with a configuration file.

To do this I followed the guide. I first installed python via the site (Python version 3.12.0), and then all the steps described in the guide link.

Now if I run the eb command from cmd I always get this error.

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Utente\.ebcli-virtual-env\Scripts\eb.exe\__main__.py", line 4, in <module>
  File "C:\Users\Utente\.ebcli-virtual-env\Lib\site-packages\ebcli\core\ebcore.py", line 16, in <module>
    from cement.core import foundation, handler, hook
  File "C:\Users\Utente\.ebcli-virtual-env\Lib\site-packages\cement\core\foundation.py", line 11, in <module>
    from ..core import output, extension, arg, controller, meta, cache, mail
  File "C:\Users\Utente\.ebcli-virtual-env\Lib\site-packages\cement\core\extension.py", line 8, in <module>
    from imp import reload  # pragma: no cover
    ^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'imp'

I've tried several things but can't come to a conclusion. Does anyone know how to help me?

I also tried installing previous versions of python, even though I didn't like it as a solution, but still I still have the problem.


Solution

  • I encountered this as well. As far as I understand its a deprecation issue.

    awsebcli will install with Python 3.12 but imp will not.

    If you type import imp into Python 3.11 you will get the following response

    DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses

    At the time of writing this, Elastic Beanstalk is only supporting 3.8, 3.9 & 3.11

    https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.python