我想通过使用以下命令将简单的Flask应用程序推送到IBM云:
%%bash
cd /resources/labs/CV0101EN/CV0101EN-capstone-project/app
ibmcloud app push
很遗憾,我在此过程中收到错误消息。 通过查看错误,我认为由于某种原因,python安装存在问题,但是我不知道是什么原因造成的。有人知道这里的问题在哪里吗?我将不胜感激。
安装日志:
Cell xxx creating container for instance yyy
Cell xxx successfully created container for instance yyy
Downloading app package...
Downloaded app package (14.8K)
-----> Python Buildpack version 1.7.6
-----> Supplying Python
**ERROR** Could not install python: no match found for 3.6.8 in [2.7.16 2.7.17 3.5.7 3.5.9 3.6.9 3.6.10 3.7.5 3.7.6 3.8.0 3.8.1]
Failed to compile droplet: Failed to run all supply scripts: exit status 14
Exit status 223
Cell xxx stopping instance yyy
Cell xxx destroying container for instance yyy
Cell ef638021-80ae-4fa7-b9d7-fca401983c23 successfully destroyed container for instance yyy
FAILED
以下是Jupiter笔记本中显示的错误。
Error staging application: App staging failed in the buildpack compile phase
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
<ipython-input-32-b9984b2b336d> in <module>
----> 1 get_ipython().run_cell_magic('bash', '', 'cd /resources/labs/CV0101EN/CV0101EN-capstone-project/app\nibmcloud app push\n')
~/conda/envs/python/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2360 with self.builtin_trap:
2361 args = (magic_arg_s, cell)
-> 2362 result = fn(*args, **kwargs)
2363 return result
2364
~/conda/envs/python/lib/python3.6/site-packages/IPython/core/magics/script.py in named_script_magic(line, cell)
140 else:
141 line = script
--> 142 return self.shebang(line, cell)
143
144 # write a basic docstring:
</home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/decorator.py:decorator-gen-110> in shebang(self, line, cell)
~/conda/envs/python/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
~/conda/envs/python/lib/python3.6/site-packages/IPython/core/magics/script.py in shebang(self, line, cell)
243 sys.stderr.flush()
244 if args.raise_error and p.returncode!=0:
--> 245 raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
246
247 def _run_script(self, p, cell, to_close):
CalledProcessError: Command 'b'cd /resources/labs/CV0101EN/CV0101EN-capstone-project/app\nibmcloud app push\n'' returned non-zero exit status 1.
答案 0 :(得分:1)
由于大小限制,buildpack不能包含曾经创建的所有Python版本。从输出中可以看到,buildpack会告诉您所请求的版本以及受支持的版本。
错误:无法安装python:在[2.7.16 2.7.17 3.5.7 3.5.9 3.6.9 3.6.10 3.7.5 3.7.6 3.8中找不到3.6.8的匹配项.0 3.8.1]
简短的回答是,您需要在 quantity value modified_value
0 1 12.5 6.2 # applied 1 time
1 3 9.0 1.1 # applied 3 times, 9.0 -> 4.5 -> 2.2 -> 1.1
中指定受支持版本列表中的版本。可以是runtime.txt
或3.6.9
。
一个更好的解决方案是不指定特定版本,而指定分支。如果您要设置3.6.10
,那么当buildpack不再支持3.6.9时,您将在2个月内再次遇到此问题(buildpacks不断升级依赖关系,因此您可以获得最新的安全性和错误修复)。
使用3.6.x
,您将只获得buildpack支持的3.6分支的最新版本。在上面的示例中,这将导致安装3.6.10。在两个月内出现3.6.11时,您将自动获得3.6.11。
https://docs.cloudfoundry.org/buildpacks/python/index.html#runtime
答案 1 :(得分:-1)
更改项目目录中的runtime.txt文件中的Python版本即可解决此问题。 Python已成功安装。