amplify-cli: Not able to push new lambda function changes via amplify push. Error: Could not find a pipenv site-packages directory
Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker
Describe the bug A clear and concise description of what the bug is.
I am not able to do amplify push after making any changes to one of my lambda function. For example simply remove a single space.
I am receiving this error:
nstalling dependencies from Pipfile.lock (a65489)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
(node:52398) UnhandledPromiseRejectionWarning: Error: Could not find a pipenv site-packages directory at /Users/heng2j/.virtualenvs/collectorVideosProcessor-r9qVMPot/lib/python3.8/site-packages
at Object.getPipenvDir (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-python-function-runtime-provider/src/util/pyUtils.ts:24:9)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-python-function-runtime-provider/src/util/packageUtils.ts:27:21
(node:52398) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:52398) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Amplify CLI Version
You can use amplify -v
to check the amplify cli version on your system
4.39.0
To Reproduce Steps to reproduce the behavior or terminal output if applicable
I am putting my python dependencies in another lambda layer for that lambda function at opt/python
And I am using runtime Python 3.7 instead. But I have tried to run Python 3.8
Expected behavior A clear and concise description of what you expected to happen.
Successful push changes to the lambda function.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Mac
- Node Version. You can use
node -v
to check the node version on your system v12.13.0
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 24 (9 by maintainers)
I’m having a similar problem. When I add a new lambda function I have to cd into the folder and run pipenv shell, then amplify push works.
So I have to have a separate pipenv virtual environment for EVERY lambda function? Where are the docs on how to properly use pipenv and add a python lambda function with amplify. I should just be able to follow a doc and it should work.
For me, I checked that I only have python3.7 in my lambda function’s virtualenv. So I have to renamed it manually to 3.8 to fix this issue.
/Users/heng2j/.virtualenvs/collectorVideosProcessor-r9qVMPot/lib/python3.8/site-packages
@heng2j I’m having the exact same issue. Have you found a workaround yet?
amplify pull
did the trick for me. It must have recreated what was missing (obviously I already had python and pipenv). Think of it this way … if you were to pick up on a brand new machine, you wouldn’t have any of those files under ~/.local/share/virtualenvs or ~/.virtualenvs. That’s technically what happened to me (migrated Amplify project to M1 Mac).UPDATE: Scratch that. It appears I would have to run pull before push every time. It’s no fix. I’ll tell you what seems to reliably do the trick:
pipenv run amplify push
This worked for me, I don’t normally reply lol. Thank you and @akshbhu.
thanks @rt-demetri this worked for me
pipenv run amplify push