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

Question:

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!

Asked By: Pedro Vidal

||

Answers:

Ran into this same problem as well. The issue was that I needed to upgrade the version of Pip installed by Homebrew to 20.3, which uses Python’s new script wrapper format.

I ran this command, which ultimately resolved the issue:

$ python3 -m pip install --upgrade pip

Note that I’m using the command python3 and not python. Python3 is the PATH variable for Homebrew’s specific installation of Python.

Anyway, after I ran this, my sam build command worked without issues.

Answered By: Greg

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.

Answered By: Scott McAllister

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

Answered By: Luciano Marqueto

You’re missing pip to resolve dependencies.

Try to install:

sudo apt-get install python3-pip
Answered By: labs