[Fixed] awslocal: command not found error after installing awscli-local – Pip

by
Ali Hasan
aws-cli azure-pipelines

Quick Fix: 1. Ensure that the directory containing the "awslocal" command is added to your system’s PATH variable.

  1. Close and reopen your terminal window or source your shell startup script (e.g., ". ~/.bashrc") to load the updated PATH variable.

The Problem:

After installing the ‘awscli-local’ package using ‘pip install awscli-local’, attempts to execute any ‘awslocal’ command result in the ‘awslocal: command not found’ error. The issue persists despite successful installation of the package. The user is running on Ubuntu 22.04.3 LTS with pip version 22.0.2, aws-cli/2.9.23, and Python 3.10.12. The cause of the problem needs to be identified.

The Solutions:

Solution 1: Check if Your PATH Includes the AWS CLI Local Installation Directory

When you install AWS CLI Local using pip install awscli-local, it doesn’t automatically modify your PATH environment variable to include the location of the AWS CLI Local binary. This can result in the awslocal: command not found error when you try to run AWS CLI Local commands.

To resolve this issue, you can add the AWS CLI Local installation directory to your PATH environment variable. Here’s how to do it:

  1. Open your terminal window.
  2. Run the following command to find the installation directory of AWS CLI Local:
pip show awscli-local

This command will display the installation path of AWS CLI Local. Copy the path to your clipboard.

  1. Open the file that contains your shell startup script. On most Linux distributions, it’s usually .bashrc or .zshrc.

  2. Add the following line to the end of the file:

export PATH=$PATH:/path/to/awslocal

Replace /path/to/awslocal with the installation path of AWS CLI Local that you copied in step 2.

  1. Save and close the file.

  2. Source your shell startup script by running the following command:

source ~/.bashrc

Or, you can close and re-open your terminal window.

Now, AWS CLI Local commands should be available in your terminal. Try running awslocal --version to verify that it’s working correctly.

Q&A

Why am I getting the awslocal: command not found error after installing awscli-local?

You may need to source your startup script or restart your terminal shell.

What is the most common cause of the command not found error after installing new software?

The installation may need to modify your PATH environment variable.

How can I add a new app’s path to my PATH environment variable?

You can edit your shell startup script (e.g. .bashrc) or use the export command.

Video Explanation:

The following video, titled "Install the AWS CLI on Mac OS // How to download, install, and ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

... install, and configure the AWS Command Line Interface (AWS CLI) version 2 using the terminal on Mac OS. ✓ SUBSCRIBE TO THIS CHANNEL: http ...