The AWS command is installed, but not working

SYSTEM INFORMATION
OS type and version Debian 11
Webmin version 2.021
Virtualmin version 7.7 Pro
Related packages aws-cli

I have configured AWS to utilize the awscli-plugin-endpoint .

The installation of the package consisted of installing pip using, apt install pip, which loaded python3.9 along with it.

Using pip install awscli-plugin-endpoint to install the plugin.

Then the configuration file location in /root/.aws/config has the following parameters in order to recognize the new plugin.

[plugins]
endpoint = awscli_plugin_endpoint
cli_legacy_plugin_path = /usr/local/lib/python3.9/dist-packages

The new plugin allows the backup of virtualmin servers without any errors. Without the plugin the AWS would warn that the signature would did not match and virtualmin would not mark the backup as successful.

The new awscli endpoint configuration works well without any warnings but the Backup and Restore → Amazon S3 Buckets page now displays the following warning.


**Warning!** The AWS command is installed, but not working : Traceback (most recent call last): File "/bin/aws", line 27, in <module> sys.exit(main()) File "/bin/aws", line 23, in main return awscli.clidriver.main() File "/usr/lib/python3/dist-packages/awscli/clidriver.py", line 68, in main driver = create_clidriver() File "/usr/lib/python3/dist-packages/awscli/clidriver.py", line 77, in create_clidriver load_plugins(session.full_config.get('plugins', {}), File "/usr/lib/python3/dist-packages/awscli/plugin.py", line 44, in load_plugins modules = _import_plugins(plugin_mapping) File "/usr/lib/python3/dist-packages/awscli/plugin.py", line 61, in _import_plugins module = __import__(path, fromlist=[module]) ModuleNotFoundError: No module named '/usr/local/lib/python3'

I tried a couple things to resolve but did not have any success.

Any idea what could be causing this warning?

Any assistance is appreciated.

I think you just use pip install awscli

That worked on a test I did.

Virtualmin should give you a option to install with its package manager, did that fail?

I removed everything and started fresh.

Installing the AWS CLI package …

Installing package(s) with command apt-get -y -f install awscli ..

    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following packages were automatically installed and are no longer required:
      libicu65 pkg-config pkg-php-tools shtool
    Use 'apt autoremove' to remove them.
    The following NEW packages will be installed:
      awscli
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/1087 kB of archives.
    After this operation, 9616 kB of additional disk space will be used.
    Selecting previously unselected package awscli.
    (Reading database ... 
    (Reading database ... 5%
    (Reading database ... 10%
    (Reading database ... 15%
    (Reading database ... 20%
    (Reading database ... 25%
    (Reading database ... 30%
    (Reading database ... 35%
    (Reading database ... 40%
    (Reading database ... 45%
    (Reading database ... 50%
    (Reading database ... 55%
    (Reading database ... 60%
    (Reading database ... 65%
    (Reading database ... 70%
    (Reading database ... 75%
    (Reading database ... 80%
    (Reading database ... 85%
    (Reading database ... 90%
    (Reading database ... 95%
    (Reading database ... 100%
    (Reading database ... 158565 files and directories currently installed.)
    Preparing to unpack .../awscli_1.19.1-1_all.deb ...
    Unpacking awscli (1.19.1-1) ...
    Setting up awscli (1.19.1-1) ...

    .. install complete.

.. installation completed successfully

The the error message remains.


**Warning!** The AWS command is installed, but not working : Traceback (most recent call last): File "/bin/aws", line 27, in <module> sys.exit(main()) File "/bin/aws", line 23, in main return awscli.clidriver.main() File "/usr/lib/python3/dist-packages/awscli/clidriver.py", line 68, in main driver = create_clidriver() File "/usr/lib/python3/dist-packages/awscli/clidriver.py", line 77, in create_clidriver load_plugins(session.full_config.get('plugins', {}), File "/usr/lib/python3/dist-packages/awscli/plugin.py", line 44, in load_plugins modules = _import_plugins(plugin_mapping) File "/usr/lib/python3/dist-packages/awscli/plugin.py", line 61, in _import_plugins module = __import__(path, fromlist=[module]) ModuleNotFoundError: No module named '/usr/local/lib/python3'

Here’s are the pip outputs.

root@web02:/usr/lib# pip3 install awscli
Requirement already satisfied: awscli in ./python3/dist-packages (1.19.1)
root@web02:/usr/lib# pip3 install --upgrade awscli
Requirement already satisfied: awscli in ./python3/dist-packages (1.19.1)
Collecting awscli
  Downloading awscli-1.29.19-py3-none-any.whl (4.2 MB)
     |████████████████████████████████| 4.2 MB 14.4 MB/s 
Requirement already satisfied: botocore==1.31.19 in /usr/local/lib/python3.9/dist-packages (from awscli) (1.31.19)
Requirement already satisfied: s3transfer<0.7.0,>=0.6.0 in /usr/local/lib/python3.9/dist-packages (from awscli) (0.6.1)
Requirement already satisfied: colorama<0.4.5,>=0.2.5 in ./python3/dist-packages (from awscli) (0.4.4)
Requirement already satisfied: docutils<0.17,>=0.10 in ./python3/dist-packages (from awscli) (0.16)
Requirement already satisfied: PyYAML<6.1,>=3.10 in ./python3/dist-packages (from awscli) (5.3.1)
Requirement already satisfied: rsa<4.8,>=3.1.2 in ./python3/dist-packages (from awscli) (4.0)
Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in ./python3/dist-packages (from botocore==1.31.19->awscli) (0.10.0)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./python3/dist-packages (from botocore==1.31.19->awscli) (2.8.1)
Requirement already satisfied: urllib3<1.27,>=1.25.4 in ./python3/dist-packages (from botocore==1.31.19->awscli) (1.26.5)
Installing collected packages: awscli
  Attempting uninstall: awscli
    Found existing installation: awscli 1.19.1
    Not uninstalling awscli at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'awscli'. No files were found to uninstall.
Successfully installed awscli-1.29.19
root@web02:/usr/lib# pip3 install --upgrade awscli
Requirement already satisfied: awscli in /usr/local/lib/python3.9/dist-packages (1.29.19)
Collecting awscli
  Using cached awscli-1.29.19-py3-none-any.whl (4.2 MB)
  Downloading awscli-1.29.18-py3-none-any.whl (4.2 MB)
     |████████████████████████████████| 4.2 MB 39.2 MB/s 
Requirement already satisfied: colorama<0.4.5,>=0.2.5 in ./python3/dist-packages (from awscli) (0.4.4)
Requirement already satisfied: rsa<4.8,>=3.1.2 in ./python3/dist-packages (from awscli) (4.0)
Requirement already satisfied: docutils<0.17,>=0.10 in ./python3/dist-packages (from awscli) (0.16)
Requirement already satisfied: s3transfer<0.7.0,>=0.6.0 in /usr/local/lib/python3.9/dist-packages (from awscli) (0.6.1)
Requirement already satisfied: botocore==1.31.19 in /usr/local/lib/python3.9/dist-packages (from awscli) (1.31.19)
Requirement already satisfied: PyYAML<6.1,>=3.10 in ./python3/dist-packages (from awscli) (5.3.1)
Requirement already satisfied: urllib3<1.27,>=1.25.4 in ./python3/dist-packages (from botocore==1.31.19->awscli) (1.26.5)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./python3/dist-packages (from botocore==1.31.19->awscli) (2.8.1)
Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in ./python3/dist-packages (from botocore==1.31.19->awscli) (0.10.0)

Something is up with awcli it seems.

/usr/lib/python3/dist-packages# pip uninstall awscli
Found existing installation: awscli 1.29.19
Uninstalling awscli-1.29.19:
  Would remove:
    /usr/local/bin/aws
    /usr/local/bin/aws.cmd
    /usr/local/bin/aws_bash_completer
    /usr/local/bin/aws_completer
    /usr/local/bin/aws_zsh_completer.sh
    /usr/local/lib/python3.9/dist-packages/awscli-1.29.19.dist-info/*
    /usr/local/lib/python3.9/dist-packages/awscli/*
Proceed (y/n)? n

It is installed in two places.

root@web02:/usr/lib/python3/dist-packages# ls
awscli						    decorator.py	      olefile			 pyinotify-0.9.6.egg-info		  setuptools-52.0.0.egg-info
awscli-1.19.1.egg-info

This is caused by apt installing an older 1.19 version. When running apt remove awscli this version is no longer listed and the error message disappears.

I have solved this issue but removing the AWS packages. Installing the latest official AWS package and setting the region in aws config file.

[profile aaaaaaaaaaaaaaaaaa]
[default]
region = region-here
output = json
[profile qqqqqqqqqqqqqqqqqqqqqqqqq]
region = region-here

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.