amnesia
amnesia

Reputation: 1988

How to update dependencies locally on an Amplify Python Lambda function?

I'm new to Amplify and trying to create a Python Lambda, but having difficulties with dependencies when running locally. I've created the function through Amplify CLI and when I run it with either amplify function invoke myFunc or the newer recommendation amplify mock function myFunc I get no errors and the boilerplate response displays just fine.

I've tried to do a pipenv install requests both within and outside of the virtual shell and I see that the Pipfile and Pipfile.lock have been updated, and I get the "installing dependencies" progress, but if I add an import requests to the index.py I end up with a:

ModuleNotFoundError: No module named 'requests'

I have also tried to force a build with amplify function build and still no luck.

If I do an amplify push, however, and run it live on AWS, it works just fine. What am I missing on the local side?

Upvotes: 4

Views: 2126

Answers (1)

Dubiella
Dubiella

Reputation: 39

In your CLI go though the folder until you reach the function you are working on... and then execute the pipenv install

Ex: ...\amplify\backend\function\YOUR_FUNCION> pipenv install requests

Upvotes: 3

Related Questions