Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipenv 2023.6.26 breaking change to amplifyPush --simple when building backend with python function #3555

Closed
5 tasks done
breencp opened this issue Jun 27, 2023 · 4 comments
Closed
5 tasks done
Assignees
Labels
archived This issue has been locked. backend-builds usability

Comments

@breencp
Copy link

breencp commented Jun 27, 2023

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

App Id

d34baz6sf50mpj

AWS Region

us-east-1

Amplify Hosting feature

Backend builds

Frontend framework

React

Next.js version

N/A

Next.js router

N/A

Describe the bug

I'm using CodeCommit for CI/CD to an AWS Amplify application.

During the amplifyPush, this error would occur on previously working functions with no changes:

2023-06-27T09:27:41.100Z [INFO]: Installing dependencies from Pipfile.lock (2a8f7d)...
2023-06-27T09:27:41.144Z [WARNING]: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'egg_info'
2023-06-27T09:27:41.265Z [WARNING]: ✖ There was an error initializing your environment.
2023-06-27T09:27:41.266Z [INFO]: 🛑 Failed to install dependencies in /.../amplify/backend/function/...: Error: Command failed with exit code 1: pipenv install

Expected behavior

2023-06-25T10:19:52.488Z [INFO]: Installing dependencies from Pipfile.lock (fbf9bb)...
2023-06-25T10:19:57.153Z [INFO]: To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
2023-06-25T10:20:01.364Z [WARNING]: - Uploading files.

Reproduction steps

Build any previously working AWS Amplify application with a Python lambda function in the backend.

Build Settings

phases:
    build:
      commands:
        - update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 15
        - /usr/local/bin/python3.9 -m pip install --upgrade pip
        - /usr/local/bin/pip3.9 install --upgrade setuptools
        - /usr/local/bin/pip3.9 install pipenv
        - amplifyPush --simple


### Log output

<details>

Put your logs below this line


</details>


### Additional information

The solution ended up being easy.  Change a single line in the setup.py of every function.

from distutils.core import setup

from setuptools import setup

setup(name='src', version='1.0')


After that, builds are successful.
@Jay2113
Copy link
Contributor

Jay2113 commented Jun 28, 2023

Hi @breencp 👋 , thanks for reaching out to us and for sharing the detailed insights on your Amplify environment.

While reviewing your backend build logs, I came across this particular error error: invalid command 'egg_info' which seems related to a breaking change with the latest pipenv release: pypa/pipenv#5753

Thank you for sharing the workaround which helped unblock your backend builds and this is going to be very useful for other developers in the community who run into something similar with their backend lambda functions.

We really appreciate it! 👏

@sushpatg
Copy link

sushpatg commented Jun 28, 2023

Hello Team,

Faced the same error when building backend with python functions. Pinning pipenv version to previous version helped me to move past the issue.

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 12
        - /usr/local/bin/pip3.9 install --user pipenv==2023.6.18
        - python3 --version
        - amplifyPush --simple

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Feb 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. backend-builds usability
Projects
None yet
Development

No branches or pull requests

3 participants