问题描述
我正在尝试使用"madmom" python pip软件包部署Python3.7 Google Cloud Function,但是在requirements.txt中指定 madmom == 0.16.1
会导致部署失败.当我从requirements.txt中删除madmom,但保留其他pip包时,云功能会正常部署.
I am trying to deploy a Python3.7 Google Cloud Function using the "madmom" python pip package, however specifying madmom==0.16.1
in requirements.txt causes a deployment failure. When I remove madmom from requirements.txt, but leave the other pip packages, the cloud function deploys fine.
madmom pypi: https://pypi.org/project/madmom/
madmom pypi: https://pypi.org/project/madmom/
madmom github: https://github.com/CPJKU/madmom
madmom github: https://github.com/CPJKU/madmom
我正在通过Google Cloud Function的在线编辑器进行部署: https://console.cloud.google.com/functions/add
I a deploying the function from Google Cloud Function's online editor: https://console.cloud.google.com/functions/add
我之前已经部署了Python Google Cloud Functions,这是我第一次遇到问题.任何帮助将不胜感激!我一直试图整天在网上找到解决方案,却一无所获.
I have deployed Python Google Cloud Functions before and this is the first time I've had issues. Any help would be very appreciated! I've been trying to find solutions online all day and haven't found anything.
Requirements.txt:
Requirements.txt:
Cython==0.29.12
ffmpeg==1.4
flask==1.0.2
madmom==0.16.1
mido==1.2.9
numpy==1.16.4
scipy==1.3.0
six==1.12.0
urllib3==1.24.2
Google Cloud Function部署失败:
Google Cloud Function Deployment Failure:
构建失败:{错误":{"canonicalCode":"INVALID_ARGUMENT","errorMessage":" pip_download_wheels
具有stderr输出:\ nCommand \" python setup.py egg_info \失败了/tmp/pip-wheel-qjxrm41i/madmom/\ n \ nerror中的错误代码1: pip_download_wheels
返回的代码:1," errorType:" InternalError," errorId:" 66F138B2}}
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "pip_download_wheels
had stderr output:\nCommand \"python setup.py egg_info\" failed with error code 1 in /tmp/pip-wheel-qjxrm41i/madmom/\n\nerror: pip_download_wheels
returned code: 1", "errorType": "InternalError", "errorId": "66F138B2"}}
衷心感谢您的帮助!
推荐答案
问题出在 madmom
包中:它与 cython
和 numpy
,但未正确声明.Cloud Functions(与大多数运行时一样)会同时安装所有依赖项,但 madmom
需要先安装 cython
和 numpy
可以安装,无法通过简单的 requirements.txt
文件进行配置.
The issue is with the madmom
package: it has a build-time dependency on cython
and numpy
, but they aren't declared properly. Cloud Functions (like most runtimes) installs all your dependencies at the same time, but madmom
needs cython
and numpy
installed before it can be installed, which isn't configurable via a simple requirements.txt
file.
我已经制作了一个PR来解决此问题,它已被合并并将可能在下一个版本中.
I've made a PR to fix this, it's been merged and will probably be in the next release.
同时,您可以使用以下 requirements.txt
文件从源存储库安装 madmom
:
In the meantime, you can install madmom
from the source repository by using the following requirements.txt
file:
git+https://github.com/CPJKU/madmom.git#egg=madmom
ffmpeg==1.4
flask==1.0.2
(请注意,您不应在此处指定顶级依赖项的所有子依赖项(例如 Cython
和 urllib3
,除非您实际上正在导入它们)在您的Cloud Function中)
(note that you shouldn't specify all the sub-dependencies of your top-level dependencies here (like Cython
and urllib3
, unless you're actually importing them in your Cloud Function)
这篇关于Python Google Google Cloud Function部署失败-Madmom pip程序包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!