'aws sam build not able to build packages which require paramiko due to "Error: PythonPipBuilder:ResolveDependencies"

I've been learning the ropes with AWS SAM and have successfully deployed a number of lambdas together with dependencies and other AWS services. However, I seem to have run into a problem when trying to deploy a lambda which relies on some specific dependencies.

Here is my requirements.txt file:

paramiko==2.4.2
cryptography==2.6.1
bcrypt==3.1.6
pynacl==1.3.0

This file is found in "packageRoot/myCodeUri/requirements.txt"

When I run sam build I get the following error:

2019-08-27 11:18:18 Running PythonPipBuilder:ResolveDependencies

Build Failed
Error: PythonPipBuilder:ResolveDependencies - {pynacl==1.3.0(wheel), cryptography==2.6.1(wheel), bcrypt==3.1.6(wheel)}

This (or at least similar) errors have been reported:here over 8 months ago but is currently not answered.

P.S. I tried this originally with just paramiko as this is the only library my script uses, as I understood; the dependencies should be automatically pulled in during the build, however this didn't work either.

Any help would be great?



Solution 1:[1]

I've managed to get a workaround to build and deploy lambdas that need the paramiko library using a docker container in interactive mode. Anyone having the same problem have a look here

Solution 2:[2]

I was getting same error with another dependency while running sam build. I was able to resolve this by installing wheel in our python (or venv) environment.

pip install wheel

This approach did not require --use-container flag while running sam build

Solution 3:[3]

Installing wheel didn't work for me, however upgrading pip did.

python -m pip install --upgrade pip

Solution 4:[4]

I had this issue when trying to use simplejson library. It was added to solve serialization issues... (pip wheel and upgrade didn't help), I just deleted the library and handle the serialization issues within the db query)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3062260
Solution 2 rahul
Solution 3 Jenna Allen
Solution 4 ginzsa-linux