I am building a website with AWS Amplify. This website uses amongst other things, several Python Lambda functions.
Today, when building I get the following error message :
๐ Received error [Error: Command failed with exit code 1: pipenv --venv
No virtualenv has been created for this project(PATH_TO_ONE_OF_THE_FUNCTIONS) yet!
Aborted!] running command [pipenv --venv]
(I have replaced the path with PATH_TO_ONE_OF_THE_FUNCTIONS because every time I try to redeploy the build it gives this error with a different function)
I have not changed anything in the backend since my last build (which was successful), I have only been working on the frontend.
I have no idea what is causing pipenv –venv to fail.
Here is my amplify.yml file :
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci --force
build:
commands:
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
backend:
phases:
build:
commands:
- update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9
- /usr/local/bin/python3.9 -m pip install --upgrade pip
- /usr/local/bin/pip3.9 install --user pipenv==2022.4.8
- amplifyPush --simple
I am using the latest version of the Amplify CLI (12.1.0) on Mac. When running amplify push on my command prompt it doesn’t raise any errors.
2
Answers
Can you change your backend command like this and try again?
I had the same issue. For me the solution didn’t worked and I resolved it by a solution I don’t think is optimal. In my amplify.yml I manually go create the pipenv for the functions adding that line for each function before the amplifyPush –simple.