aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

New python issue with 'egg_info' #3560

Closed pm98zz-c closed 1 year ago

pm98zz-c commented 1 year ago

How did you install the Amplify CLI?

NA

If applicable, what version of Node.js are you using?

16.19 (but irrelevant)

Amplify CLI Version

latest (from AWS deploy)

What operating system are you using?

amazon linux 2 container (from AWS deploy)

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

no

Describe the bug

One python function part of the project stopped being able to build since last week and this week, with no change whatsoever in amplify.yml nor amplify folder or the function itself

Expected behavior

Expected the function continue to build as usual.

Reproduction steps

I suppose (but can't be certain) any python using 3.8 as runtime would be affected. My amplify.yml looks like this

backend:
  phases:
    preBuild:
      commands:
        - nvm install $VERSION_NODE_16
    build:
      commands:
        - '# Make sure we prefetch needed packages'
        - set -xe
        - yarn install
        - '# Change the current version of python'
        - ln -fs /usr/local/bin/pip3.8 /usr/bin/pip3
        - ln -fs /usr/local/bin/python3.8 /usr/bin/python3
        - ln -fs /usr/local/bin/pip3.8 /usr/bin/pip # not originally there, added to try to fix the issue in question
        - pip3 install --upgrade pip setuptools # not originally there, added to try to fix the issue in question
        - pip3 install pipenv
        - amplifyPush --simple

Project Identifier

No response

Log output

``` 2023-06-29T08:18:25.824Z [WARNING]: Successfully created virtual environment! 2023-06-29T08:18:25.930Z [WARNING]: Virtualenv location: /root/.local/share/virtualenvs/cerfa-pQyvUyL2 2023-06-29T08:18:26.038Z [INFO]: Installing dependencies from Pipfile.lock (0b4f62)... 2023-06-29T08:18:26.181Z [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' ```

Additional information

I suspect it could actually something to do with an update in the amazon linux 2 image, as my amplify-cli version was pinned to 12.0.3 because of https://github.com/aws-amplify/amplify-cli/issues/12793, so should not be tied to a cli update.

Before submitting, please confirm:

pm98zz-c commented 1 year ago

Just to give an indication of the timeline:

pm98zz-c commented 1 year ago

Full log:

                                 # Starting phase: preBuild
                                 # Executing command: nvm install $VERSION_NODE_16
2023-06-28T13:28:37.064Z [WARNING]: v16.19.0 is already installed.
2023-06-28T13:28:37.456Z [INFO]: Now using node v16.19.0 (npm v8.19.3)
2023-06-28T13:28:37.456Z [INFO]: Installing default global packages from /root/.nvm/default-packages...
                                 npm install -g --quiet yarn@1.22.0
2023-06-28T13:28:38.673Z [INFO]: changed 1 package, and audited 2 packages in 948ms
2023-06-28T13:28:38.673Z [INFO]: found 0 vulnerabilities
2023-06-28T13:28:38.684Z [INFO]: # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: set -xe
2023-06-28T13:28:38.685Z [INFO]: # Executing command: yarn install
2023-06-28T13:28:38.685Z [WARNING]: + EXIT=0
                                    + '[' 0 -gt 0 ']'
                                    + echo '# Executing command: yarn install'
                                    + yarn install
2023-06-28T13:28:38.988Z [INFO]: yarn install v1.22.0
2023-06-28T13:28:39.126Z [INFO]: [1/4] Resolving packages...
2023-06-28T13:28:39.899Z [INFO]: success Already up-to-date.
2023-06-28T13:28:39.908Z [INFO]: Done in 0.92s.
2023-06-28T13:28:39.918Z [WARNING]: + EXIT=0
                                    + '[' 0 -gt 0 ']'
2023-06-28T13:28:39.918Z [WARNING]: + echo '# Executing command: ln -fs /usr/local/bin/pip3.8 /usr/bin/pip3 || exit 1'
                                    + ln -fs /usr/local/bin/pip3.8 /usr/bin/pip3
2023-06-28T13:28:39.918Z [INFO]: # Executing command: ln -fs /usr/local/bin/pip3.8 /usr/bin/pip3 || exit 1
2023-06-28T13:28:39.926Z [WARNING]: + EXIT=0
                                    + '[' 0 -gt 0 ']'
2023-06-28T13:28:39.927Z [WARNING]: + echo '# Executing command: ln -fs /usr/local/bin/python3.8 /usr/bin/python3'
                                    + ln -fs /usr/local/bin/python3.8 /usr/bin/python3
2023-06-28T13:28:39.927Z [INFO]: # Executing command: ln -fs /usr/local/bin/python3.8 /usr/bin/python3
2023-06-28T13:28:39.928Z [WARNING]: + EXIT=0
                                    + '[' 0 -gt 0 ']'
2023-06-28T13:28:39.928Z [WARNING]: + echo '# Executing command: pip3 install pipenv'
                                    + pip3 install pipenv
2023-06-28T13:28:39.928Z [INFO]: # Executing command: pip3 install pipenv
2023-06-28T13:28:47.437Z [INFO]: Collecting pipenv
2023-06-28T13:28:47.938Z [INFO]: Downloading https://files.pythonhosted.org/packages/e3/1f/4a8dfe039648fdee3b1cb4b7825c2c3b79436ed21bff0ed4133f0e9f6bd3/pipenv-2023.6.26-py3-none-any.whl (2.8MB)
2023-06-28T13:28:48.140Z [INFO]: Collecting virtualenv>=20.17.1 (from pipenv)
2023-06-28T13:28:48.349Z [INFO]: Downloading https://files.pythonhosted.org/packages/2a/5b/f5ba6ec56448dc85abb75b97dc918a621a52d119ade29c8c1b7e916b0cd3/virtualenv-20.23.1-py3-none-any.whl (3.3MB)
2023-06-28T13:28:48.445Z [INFO]: Collecting virtualenv-clone>=0.2.5 (from pipenv)
2023-06-28T13:28:48.480Z [INFO]: Downloading https://files.pythonhosted.org/packages/21/ac/e07058dc5a6c1b97f751d24f20d4b0ec14d735d77f4a1f78c471d6d13a43/virtualenv_clone-0.5.7-py3-none-any.whl
2023-06-28T13:28:48.491Z [INFO]: Requirement already satisfied: certifi in /usr/local/lib/python3.8/site-packages (from pipenv) (2022.12.7)
2023-06-28T13:28:48.529Z [INFO]: Collecting setuptools>=67.0.0 (from pipenv)
2023-06-28T13:28:48.947Z [INFO]: Downloading https://files.pythonhosted.org/packages/c7/42/be1c7bbdd83e1bfb160c94b9cafd8e25efc7400346cf7ccdbdb452c467fa/setuptools-68.0.0-py3-none-any.whl (804kB)
2023-06-28T13:28:49.033Z [INFO]: Collecting distlib<1,>=0.3.6 (from virtualenv>=20.17.1->pipenv)
2023-06-28T13:28:49.113Z [INFO]: Downloading https://files.pythonhosted.org/packages/76/cb/6bbd2b10170ed991cf64e8c8b85e01f2fb38f95d1bc77617569e0b0b26ac/distlib-0.3.6-py2.py3-none-any.whl (468kB)
2023-06-28T13:28:49.142Z [INFO]: Collecting filelock<4,>=3.12 (from virtualenv>=20.17.1->pipenv)
2023-06-28T13:28:49.330Z [INFO]: Downloading https://files.pythonhosted.org/packages/00/45/ec3407adf6f6b5bf867a4462b2b0af27597a26bd3cd6e2534cb6ab029938/filelock-3.12.2-py3-none-any.whl
2023-06-28T13:28:49.355Z [INFO]: Collecting platformdirs<4,>=3.5.1 (from virtualenv>=20.17.1->pipenv)
2023-06-28T13:28:49.454Z [INFO]: Downloading https://files.pythonhosted.org/packages/e7/61/7fde5beff25a0dae6c2056203696169bd29188b6cedefff8ba6e7b54417b/platformdirs-3.8.0-py3-none-any.whl
2023-06-28T13:28:51.229Z [INFO]: Installing collected packages: distlib, filelock, platformdirs, virtualenv, virtualenv-clone, setuptools, pipenv
2023-06-28T13:28:51.447Z [INFO]: Found existing installation: setuptools 41.2.0
2023-06-28T13:28:51.848Z [INFO]: Uninstalling setuptools-41.2.0:
2023-06-28T13:28:58.145Z [INFO]: Successfully uninstalled setuptools-41.2.0
2023-06-28T13:29:00.187Z [INFO]: Successfully installed distlib-0.3.6 filelock-3.12.2 pipenv-2023.6.26 platformdirs-3.8.0 setuptools-68.0.0 virtualenv-20.23.1 virtualenv-clone-0.5.7
2023-06-28T13:29:00.440Z [WARNING]: WARNING: You are using pip version 19.2.3, however version 23.1.2 is available.
                                    You should consider upgrading via the 'pip install --upgrade pip' command.
2023-06-28T13:29:00.472Z [WARNING]: + EXIT=0
                                    + '[' 0 -gt 0 ']'
2023-06-28T13:29:00.473Z [WARNING]: + amplify pull --amplify XXX'
2023-06-28T13:29:03.010Z [INFO]: Amplify AppID found: XXX. Amplify App name is: XXX[0m
2023-06-28T13:29:03.083Z [INFO]: Backend environment XXX found in Amplify Console app: XXX[0m
2023-06-28T13:29:04.129Z [WARNING]: - Fetching updates to backend environment: XXX from the cloud.
2023-06-28T13:29:05.182Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:05.204Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:05.221Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:05.221Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:05.222Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:05.222Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:05.223Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:05.223Z [WARNING]: - Building resource auth/XXX
2023-06-28T13:29:05.276Z [WARNING]: ✔ Successfully pulled backend environment XXX from the cloud.
2023-06-28T13:29:05.902Z [WARNING]: Browserslist: caniuse-lite is outdated. Please run:
                                    npx update-browserslist-db@latest
                                    Why you should do it regularly: https://github.com/browserslist/update-db#readme
2023-06-28T13:29:05.969Z [INFO]: ✅
2023-06-28T13:29:06.525Z [WARNING]: + amplify init --amplify '{"envName":"XXX","appId":"XXX"}' --providers '{"awscloudformation":{"configLevel":"project","useProfile":true,"profileName":"default"}}' --codegen '{"generateCode":false,"generateDocs":false}' --yes --categories 'XXX' --forcePush
2023-06-28T13:29:09.894Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2023-06-28T13:29:10.687Z [WARNING]: - Initializing your environment: XXX
2023-06-28T13:29:11.529Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:11.557Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:11.574Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:11.575Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:11.575Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:11.576Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:11.576Z [WARNING]: - Building resource api/XXX
2023-06-28T13:29:11.576Z [WARNING]: - Building resource auth/XXX
2023-06-28T13:29:11.595Z [WARNING]: ✔ Initialized provider successfully.
2023-06-28T13:30:04.399Z [WARNING]: Creating a virtualenv for this project...
2023-06-28T13:30:04.401Z [WARNING]: Pipfile: /codebuild/output/src1778547412/src/XXX/amplify/backend/function/XXX/Pipfile
2023-06-28T13:30:04.421Z [WARNING]: Using /usr/local/bin/python3.8 (3.8.0) to create virtualenv...
2023-06-28T13:30:05.295Z [WARNING]: created virtual environment CPython3.8.0.final.0-64 in 543ms
                                    creator CPython3Posix(dest=/root/.local/share/virtualenvs/XXX-isGWARKF, clear=False, no_vcs_ignore=False, global=False)
                                    seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
                                    added seed packages: pip==23.1.2, setuptools==67.8.0, wheel==0.40.0
                                    activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
2023-06-28T13:30:05.302Z [WARNING]: Successfully created virtual environment!
2023-06-28T13:30:05.421Z [WARNING]: Virtualenv location: /root/.local/share/virtualenvs/XXX-isGWARKF
2023-06-28T13:30:05.522Z [INFO]: Installing dependencies from Pipfile.lock (0b4f62)...
2023-06-28T13:30:06.714Z [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-28T13:30:06.911Z [WARNING]: ✖ There was an error initializing your environment.
2023-06-28T13:30:06.913Z [INFO]: 🛑 Failed to install dependencies in /codebuild/output/src1778547412/src/XXX/amplify/backend/function/XXX: Error: Command failed with exit code 1: pipenv install
2023-06-28T13:30:06.913Z [INFO]: 
2023-06-28T13:30:06.914Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
2023-06-28T13:30:06.968Z [INFO]: 
2023-06-28T13:30:06.968Z [INFO]: Session Identifier: XXX
2023-06-28T13:30:07.009Z [ERROR]: !!! Build failed
2023-06-28T13:30:07.010Z [ERROR]: !!! Non-Zero Exit Code detected
2023-06-28T13:30:07.010Z [INFO]: # Starting environment caching...
2023-06-28T13:30:07.011Z [INFO]: # Uploading environment cache artifact...
2023-06-28T13:30:07.082Z [INFO]: # Uploaded environment cache artifact
2023-06-28T13:30:07.083Z [INFO]: # Environment caching completed
Terminating logging...
josefaidt commented 1 year ago

Hey @pm98zz-c :wave: thanks for raising this! This is a duplicate of https://github.com/aws-amplify/amplify-hosting/issues/3555, where it is due to a change in pipenv. I'll transfer this over to Hosting for tracking purposes, but will close this in favor of tracking the existing issue. Please take a look at this comment for more details

Jay2113 commented 1 year ago

Closing this thread in favor of https://github.com/aws-amplify/amplify-hosting/issues/3555.

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

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.

github-actions[bot] commented 1 year ago

This issue has been automatically locked.