Python 使用TensorFlow作为依赖项部署Google云功能
我想使用Google云函数部署一个以JSON(包括HDF5中的权重)保存的keras模型,并将tensorflow作为后端 当我没有在requirements.txt中指定tensorflow时,部署成功。虽然在GCP中测试该函数时,我收到一条错误消息,指明找不到tensorflowPython 使用TensorFlow作为依赖项部署Google云功能,python,tensorflow,keras,google-cloud-platform,google-cloud-functions,Python,Tensorflow,Keras,Google Cloud Platform,Google Cloud Functions,我想使用Google云函数部署一个以JSON(包括HDF5中的权重)保存的keras模型,并将tensorflow作为后端 当我没有在requirements.txt中指定tensorflow时,部署成功。虽然在GCP中测试该函数时,我收到一条错误消息,指明找不到tensorflow Error: function crashed. Details: No module named 'tensorflow' 首先,我觉得很奇怪,谷歌没有提供预安装tensorflow的环境 但现在如果我在req
Error: function crashed. Details:
No module named 'tensorflow'
首先,我觉得很奇怪,谷歌没有提供预安装tensorflow的环境
但现在如果我在requirements.txt中指定tensorflow,部署就会失败,并显示错误消息
ERROR: (gcloud.beta.functions.deploy) OperationError:
code=3, message=Build failed: USER ERROR:
`pip_download_wheels` had stderr output:
Could not find a version that satisfies the
requirement tensorflow (from -r /dev/stdin (line 5))
(from versions: )
No matching distribution found for tensorflow (from -r
/dev/stdin (line 5))
有没有一种方法可以让tensorflow在云上运行,或者Google故意阻止安装,让我们使用ML引擎?编辑:
先前的答案: 目前还没有一种方法可以在谷歌云函数上使用
tensorflow
然而,这并不是因为谷歌故意阻止它:只为CPython2.7、3.3、3.4、3.5和3.6提供内置发行版,但是,因此pip
(正确地)找不到任何兼容的发行版
目前有,但一旦修复,
tensorflow
应该可以安装在谷歌云功能上。不过现在,您必须使用ML引擎。非常感谢您提供了其他任何地方都没有的信息!现在,这终于解释了为什么谷歌云功能无法使用TensorFlow后端导入Keras…仅供参考,