Heroku pip install suddenly started to return an error: use_2to3 is invalid

Heroku pip install suddenly started to return an error: use_2to3 is invalid

Heroku 部署在尝试部署 python 应用程序时开始 return 此错误:

-----> 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

没有变化

Heroku recently 将 python 构建包

的设置工具更新为 60.10.0

However, the setuptools upgrade also drops support for the deprecated use_2to3 feature, which may be used be a small number of legacy dependency versions. This change occurred in setuptools 58.0.0 (released 2021-09-04), which we have deliberately not updated to for as long as possible, in order to give any affected packages time to be fixed. However it's no longer viable to delay updating any longer, due to the pipenv compatibility issues.

上面的拉取请求有一些选项可以修复受影响的包。在我的例子中,我们不需要 anyjson,从 requirements.txt 中删除它解决了问题