AWS Amplify后端构建错误:无效命令 ‘egg_info’

huangapple go评论71阅读模式
英文:

AWS Amplify backend build error: invalid command 'egg_info'

问题

I can translate the provided text for you:

我正尝试部署到AWS Amplify,但在后端构建时出现了以下错误(我已包含了一些前面的日志以供参考):

2023-06-29T00:41:53.568Z [WARNING]: created virtual environment CPython3.8.0.final.0-64 in 734ms
                                    creator CPython3Posix(dest=/root/.local/share/virtualenvs/lambdafunction-TMn4ayDM, 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-29T00:41:53.574Z [WARNING]: ✔ Successfully created virtual environment!
2023-06-29T00:41:53.604Z [WARNING]: Virtualenv location: /root/.local/share/virtualenvs/lambdafunction-tyBXm4FQ
2023-06-29T00:31:41.678Z [INFO]: Installing dependencies from Pipfile.lock (3a12ae)...
2023-06-29T00:31:41.712Z [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-29T00:31:41.811Z [WARNING]: ✖ There was an error initializing your environment.
2023-06-29T00:31:41.812Z [INFO]: 🛑 Command failed with exit code 1: pipenv install

这在之前是可以工作的,但在我进行了一些UI更改后开始失败,我认为这与更改无关。我还尝试在lambda函数目录中的Pipfile中更新到最新版本的setuptools。

这是我的amplify.yml文件的后端部分:

backend:
  phases:
    preBuild:
      commands:
        - ln -fs /usr/local/bin/pip3.8 /usr/bin/pip3
        - ln -fs /usr/local/bin/python3.8 /usr/bin/python3
        - python3 -m pip install --upgrade pip
        - python3 -m pip install --upgrade setuptools wheel
        - python3 -m pip install --upgrade pipenv
    build:
      commands:
        - amplifyPush --simple

请注意,代码部分未进行翻译,仅翻译了您提供的文本。

英文:

I'm trying to deploy to AWS amplify, but I'm getting this error on the backend build (I've included some of the preceding logs in case it's helpful):

2023-06-29T00:41:53.568Z [WARNING]: created virtual environment CPython3.8.0.final.0-64 in 734ms
                                    creator CPython3Posix(dest=/root/.local/share/virtualenvs/lambdafunction-TMn4ayDM, 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-29T00:41:53.574Z [WARNING]: ✔ Successfully created virtual environment!
2023-06-29T00:41:53.604Z [WARNING]: Virtualenv location: /root/.local/share/virtualenvs/lambdafunction-tyBXm4FQ
2023-06-29T00:31:41.678Z [INFO]: Installing dependencies from Pipfile.lock (3a12ae)...
2023-06-29T00:31:41.712Z [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-29T00:31:41.811Z [WARNING]: ✖ There was an error initializing your environment.
2023-06-29T00:31:41.812Z [INFO]: 🛑 Command failed with exit code 1: pipenv install

This was working before, but it started failing after I made some UI changes, which I wouldn't think would be related. I've also tried updating to the latest version of setuptools in the Pipfile within the lambda function directory.

This is the backend section of my my amplify.yml:

backend:
  phases:
    preBuild:
      commands:
        - ln -fs /usr/local/bin/pip3.8 /usr/bin/pip3
        - ln -fs /usr/local/bin/python3.8 /usr/bin/python3
        - python3 -m pip install --upgrade pip
        - python3 -m pip install --upgrade setuptools wheel
        - python3 -m pip install --upgrade pipenv
    build:
      commands:
        - amplifyPush --simple

答案1

得分: 3

如果在你的 functions setup.py 文件中从 distutils.core 导入 setup,可能会引起问题,因为它已经过时了,请尝试从 setuptools 导入 setup:

from setuptools import setup

英文:

If you're importing setup in your functions setup.py file from distutils.core using:

> from distutils.core import setup

this might be causing the issue as it is out of date, try importing setup from setuptools:

> from setuptools import setup

huangapple
  • 本文由 发表于 2023年6月29日 08:50:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76577485.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定