Closed NTonani closed 4 years ago
The pip that is used is python -m pip
and which python is being used is decided by the first python that is encountered on PATH that matches the python runtime version specified on the template.
tl;dr pip install wheel
, without usage of --use-container
.
This fixed it for me and I think you are encountering the same problem, but it's hard for me to say for sure with only having access to the traceback.
I will try and explain..
The failing command is not the pip download
you mentioned in the original post, but a later pip wheel
command. aws-sam-cli
relies on aws-lambda-builders
to handle the pip download part of SAM.
It attempts to get the platform-specific binary wheels when it can; but not all packages are shipped to PyPi with those wheels. So in those cases, it seems it tries to build the wheel from the sdist
, and for that it requires the wheel
package.. and when that does not exist - you get this MissingDependencies error.
I'm not sure on the reasoning behind not having wheel
as a dependency (or an optional dependency when using Python SAM functions); it seems like that would save a lot of people a great amount of time with these cryptic errors.
If you take a look at aws-lambda-builders
here it is explicitly ignoring the fact that pip wheel
might fail; I don't know about the wider program, perhaps there is a good reason, but this doesn't seem wise to me.
HTH.
Going to close this issue. Sam build --use-container makes sure that the wheels that are built are directly usable in a lambda environment. Looks like levenstien
for example depends on certain C bindings.
What @djm points out is also true, that you need the wheel package to be able to build wheels. (Need better documentation on this).
@sriram-mv Can you explain further? Not sure what '...makes sure that the wheels that are built are directly usable in a lambda environment' means.
I have other dependencies that depend on wheel builds so the issue is not missing the wheel
package.
I'm not able to use --use-container
any longer as I would require a custom base Docker image, which isn't supported.
tl;dr
pip install wheel
, without usage of--use-container
.@djm Could you explain more about your approach? I've got the same problem trying run local lambda function from PyCharm with AWS Toolkit plugin. I've tried both options(with and without --use-container) running sam build Function and got error:
PythonPipBuilder:ResolveDependencies - {fbprophet==0.6(sdist), ephem==3.7.7.1(wheel)}
This happened to me because my system interrupter 3.9 was not compatible with my sam 3.8 python project.
Removing the sam system install and replace it with the pip version in my requirement files made it work again.
Description
Build is failing to resolve a couple dependencies:
{simplejson==3.17.0(wheel), python-levenshtein==0.12.0(sdist)}
I am using pipenv / requirements.txt to manage.If I run in container, it succeeds. That along with the many suggestions in other issues leads to pip / python mismatch.
If I manually run
pip download -r /Users/ntonani/workplace/kopa/kopa_serverless/kopa-message-receiver/src/requirements.txt --dest /var/folders/59/dtdk2xg14n13v15zydzkqtwh0000gn/T/tmps99l0k96
- the failing command - it succeeds. This leads me to believe the pip used by SAM is different.How do I find out which pip SAM is using?
Observed result
Expected result
sam build
succeedsAdditional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 0.40.0