Agilulfo
Agilulfo

Reputation: 111

How to completly remove AWS SAM CLI and SAM CLI from ubuntu?

a month ago I needed to install aws-sam on my pc. I don't remember what went wrong but I ended with 2 different version of sam installed in the same computer. And I know this because if I run sam --version inside the terminal I get this output:

A newer version of the AWS SAM CLI is available!
Your version:   0.2.11
Latest version: 1.0.0
See https://github.com/awslabs/aws-sam-local for upgrade instructions

sam version 0.2.11

Instead if I type sam --version inside the terminal of Virtual Studio Code I get this output:

SAM CLI, version 0.53.0

(weird)

For the project I need to interact with I need the second version of sam (the one with 0.53.0). I would like to remove both of them and do a clean install again.

Upvotes: 2

Views: 7254

Answers (1)

Marcin
Marcin

Reputation: 238131

Based on the comments.

There are two sam packages, because one was installed using pip3 and the other was installed using brew. This can be checked using the following commands:

pip3 freeze | grep sam

# and

brew list --versions | grep aws

To uninstall the brew version, the following command can be used:

brew uninstall aws-sam-cli

The change may require later adjustment/setting of PATH in ~/.bashrc to correctly point to the remaining sam version's folder:

export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH

Upvotes: 5

Related Questions