ModuleNotFoundError: No module named 'imp'
Asked Answered
V

3

23

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.

Vogue answered 1/11, 2023 at 9:57 Comment(0)
S
24

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

Steerageway answered 2/11, 2023 at 17:20 Comment(0)
A
4

It solved for me after installing below package.

pip install cement==2.10.14

enter image description here

Article answered 18/6 at 3:55 Comment(1)
That worked for me. Thanks.Caliphate
H
2

if you are using windows 11 and python 3.12, this works for me, hoping it helps someone else

check py.exe on your system

~\dev  on ⛅ (Seoul)
PS > get-command py

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     py.exe                                             3.12.2150… C:\Users\hdformat\AppData\Local\Programs…

check pythons on your system

~\dev  on ⛅ (Seoul)
PS > py --list

 -V:3.12 *        Python 3.12 (64-bit)

install python 3.11 from dowloading a installer on python official site

https://www.python.org/downloads/release/python-3117/

check pythons again after

~\dev  on ⛅ (Seoul)
PS > py --list
 -V:3.12 *        Python 3.12 (64-bit)
 -V:3.11          Python 3.11 (64-bit)

run eb-cli installer using python 3.11

~\dev  on ⛅ (Seoul) took 3s
PS > py -3.11 .\aws-elastic-beanstalk-cli-setup\scripts\ebcli_installer.py

***********************************
1. Locating virtualenv installation
***********************************
...
***************
6. Finishing up
***************
Success!

EBCLI has been installed.

run eb cli

~\dev  on ⛅ (Seoul) took 10s
PS > eb --help
usage: eb (sub-commands ...) [options ...] {arguments ...}

Welcome to the Elastic Beanstalk Command Line Interface (EB CLI).
For more information on a specific command, type "eb {cmd} --help".

commands:
  abort        Cancels an environment update or deployment.
  appversion   Listing and managing application versions
  clone        Clones an environment.
  codesource   Configures the code source for the EB CLI to use by default.
  config       Modify an environment's configuration. Use subcommands to manage saved configurations.
  console      Opens the environment in the AWS Elastic Beanstalk Management Console.
  create       Creates a new environment.
  deploy       Deploys your source code to the environment.
  events       Gets recent events.
  health       Shows detailed environment health.
  init         Initializes your directory with the EB CLI. Creates the application.
  labs         Extra experimental commands.
  list         Lists all environments.
  local        Runs commands on your local machine.
  logs         Gets recent logs.
  open         Opens the application URL in a browser.
  platform     Commands for managing platforms.
  printenv     Shows the environment variables.
  restore      Restores a terminated environment.
  scale        Changes the number of running instances.
  setenv       Sets environment variables.
  ssh          Opens the SSH client to connect to an instance.
  status       Gets environment information and status.
  swap         Swaps two environment CNAMEs with each other.
  tags         Allows adding, deleting, updating, and listing of environment tags.
  terminate    Terminates the environment.
  upgrade      Updates the environment to the most recent platform version.
  use          Sets default environment.

options:
  -h, --help            show this help message and exit
  --debug               toggle debug output
  --quiet               suppress all output
  -v, --verbose         toggle verbose output
  --profile PROFILE     use a specific profile from your credential file
  -r REGION, --region REGION
                        use a specific region
  --no-verify-ssl       don't verify AWS SSL certificates
  --version             show application/version info

To get started type "eb init". Then type "eb create" and "eb open"

Hawkbill answered 28/3 at 1:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.