SAM Build only completes successfully with --use-container parameter
One workaround that may or may not work depending on your particular dependency/dependencies is to use one of the possibly existing previous versions of your problematic dependency/dependencies, which as a consequence might (a) have older dependencies that might have wheels on PyPI or (b) lack the problematic dependencies.
For example, the PythonPipBuilder:ResolveDependencies
error is raised with jsonschema==3.2.0
because it depends on pyrsistent
that doesn't currently have wheels on PyPI. However, the error is not produced with jsonschema==2.6.0
because it doesn't depend on pyrsistent
.
I don't have an explanation of WHY this works with --use-container
, but I had the same problem and nobody else seems to be answering this.
It appears that some of the libraries you are trying to use are missing wheel files. It actually says so in the debug message, but it's not easy to find if you don't know what you are looking for. More about wheels at https://pythonwheels.com/.
So, after a few hours of digging, I ran the following command in the terminal:
pip install wheel
After that, I could build, invoke the function locally, and deploy to AWS without the --use-container
parameter.
I had the same issue, specifically with psycopg2
, and pip install wheel
or --use-container
did not help.
What I did instead was installing the binary version of the package in question pip install psycopg2-binary
, and also included psycopg2-binary
in the requirements.txt
file.
This solved my problem, hope it helps.
I got the same problem when using python3.8.8
, installed with pyenv
. I also found a hint about wheel
in the debug-output, but it was already installed.
I was able to fix it by upgrading pip
:
/Users/xyz/.pyenv/versions/3.8.8/bin/python3.8 -m pip install --upgrade pip