Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws sam deployment failed due to pip executable not found - python

I am attempting to perform a sam deployment and upon running the command:

sam build --template template.yaml --build-dir ./build --use-container

I see that the image "amazon/aws-sam-cli-build-image-python3.6" is successfully pulled but then I obtain the following error:

Build Failed Error: PythonPipBuilder:ResolveDependencies - pip executable not found in your python environment at /var/lang/bin/python3.6

I really have no clue why this is happening since I would expect that once the python image was pulled, pip and its dependencies would be installed.

Appreciate any help, thanks in advance!

like image 968
Pedro Vidal Avatar asked Sep 01 '25 20:09

Pedro Vidal


2 Answers

You need to install the pip for your python distribution like this:

sudo apt-get install python3-pip

More in this link: Python 3.6 No module named pip

like image 151
Luciano Marqueto Avatar answered Sep 04 '25 10:09

Luciano Marqueto


I encountered this issue after installing the sam-cli with pipx (I also use pyenv). My global python version from pyenv was 3.6 and the sam-cli was somehow finding python at /usr/bin/python3.8 instead of the pyenv shim. After setting the local python version to 3.8.6 with pyenv's .python-version file in the root of the project, the error message went away.

like image 28
Scott McAllister Avatar answered Sep 04 '25 10:09

Scott McAllister