【问题标题】:Heroku pip install suddenly started to return an error: use_2to3 is invalidHeroku pip install 突然开始返回错误:use_2to3 is invalid
【发布时间】:2022-07-28 17:54:19
【问题描述】:

Heroku deploy 在尝试部署 python 应用时开始返回此错误:

-----> Installing requirements with pip
       Collecting amqp==2.6.1
         Downloading amqp-2.6.1-py2.py3-none-any.whl (48 kB)
       Collecting anyjson==0.3.3
         Downloading anyjson-0.3.3.tar.gz (8.3 kB)
         Preparing metadata (setup.py): started
         Preparing metadata (setup.py): finished with status 'error'
         error: subprocess-exited-with-error
         
         × python setup.py egg_info did not run successfully.
         │ exit code: 1
         ╰─> [1 lines of output]
             error in anyjson setup command: use_2to3 is invalid.
             [end of output]
         
         note: This error originates from a subprocess, and is likely not a problem with pip.
       error: metadata-generation-failed
       
       × Encountered error while generating package metadata.
       ╰─> See above for output.
       
       note: This is an issue with the package mentioned above, not pip.
       hint: See above for details.
 !     Push rejected, failed to compile Python app.
 !     Push failed

requirements.txt 中没有变化

【问题讨论】:

    标签: python heroku pip setuptools


    【解决方案1】:

    Heroku recently 将 python 构建包的 setuptools 更新为 60.10.0

    但是,setuptools 升级也放弃了对已弃用的支持 use_2to3 功能,可能会被少量遗留使用 依赖版本。此更改发生在 setuptools 58.0.0 (2021-09-04 发布),我们故意不更新到 尽可能长的时间,以便让任何受影响的包裹有时间 固定的。然而,延迟更新不再可行,因为 pipenv 兼容性问题。

    上述拉取请求有一些选项可以修复受影响的包。就我而言,无论如何我们都不需要anyjson,将其从requirements.txt 中删除可以解决问题

    【讨论】:

    • 这对我很有帮助。我检查了终端中的错误日志,发现一些依赖项没有成功安装,我从 requirements.txt 文件中删除了它们,然后部署的工作就像一个魅力。
    • 就我而言,我只是拼错了 requirements.txt 中的一个包;更正包名解决了这个错误。
    【解决方案2】:

    我遇到了同样的错误,不幸的是降级设置工具对我没有帮助。就我而言,解决方案是卸载 kombu 包。

    【讨论】:

      猜你喜欢
      • 2020-01-26
      • 1970-01-01
      • 1970-01-01
      • 2011-06-25
      • 1970-01-01
      • 2019-11-19
      • 2019-12-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多