- Newest
- Most votes
- Most comments
You're correct that the issue is related to using AWS CLI version 1 instead of version 2. AWS CLI version 2 is indeed recommended for general use and is required for certain features like the SSO login you're attempting to use.
However, it's important to note that AWS CLI version 2 is not typically installed via pip or within a Python virtual environment. Instead, it's installed as a standalone application.
To resolve your issue, you have a couple of options:
-
Install AWS CLI version 2 system-wide: You can download and install AWS CLI v2 following the official AWS instructions for your operating system. This will install it outside of your virtual environment, but it will be available system-wide.
-
Use AWS CLI v2 alongside your virtual environment: After installing AWS CLI v2 system-wide, you can use it from within your virtual environment by specifying the full path to the AWS CLI v2 executable.
To install AWS CLI version 2 on a Linux system, you can use these commands:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
After installation, you can verify the version by running:
aws --version
This should show you're using AWS CLI version 2.
Remember, even though you're working in a Python virtual environment, you'll be using the system-wide installation of AWS CLI v2. This is the recommended approach as AWS CLI v2 is not designed to be installed in a Python virtual environment.
If you need to use AWS SDK functionality within your Python code, you should use the boto3 library, which can be installed in your virtual environment using pip.
Sources
Community | Command Line Magic | S01 E03 | Build On Weekly
AWS CLI Adds PKCE-based Authorization for SSO | AWS Developer Tools Blog
answered a year ago
Hello.
Try installing from GitHub in a venv-enabled project directory as follows:
python3 -m pip install https://github.com/boto/botocore/archive/v2.tar.gz
python3 -m pip install https://github.com/aws/aws-cli/archive/v2.tar.gz
I checked the GitHub issues for AWS CLI, but it seems that there are currently no plans to release AWS CLI v2 on PyPI.
https://github.com/aws/aws-cli/issues/4947#issuecomment-793192340
Relevant content
asked 3 years ago
asked 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 3 years ago
