簡體   English   中英

為什么在嘗試將應用程序推送到 IBM 雲時會收到錯誤消息?

[英]Why am I receiving an error when trying to push application to IBM cloud?

我想使用以下命令將一個簡單的 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.

由於大小限制,構建包不能包含曾經創建的所有 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.0 3.8.1]中找不到3.6.8的匹配項

簡短的回答是您需要在runtime.txt中指定支持版本列表中的版本。 那可能是3.6.93.6.10

更好的解決方案是不指定特定版本,而是指定一個分支。 如果您要設置3.6.x那么當 buildpack 不再支持 3.6.9 時,您將不會在 2 個月內再次遇到此問題(buildpack 不斷升級依賴項,因此您可以獲得最新的安全性和錯誤修復)。

使用3.6.x ,您將獲得 buildpack 支持的 3.6 分支的最新版本。 在上面的示例中,這將導致安裝 3.6.10。 在有 3.6.11 的兩個月后,您將自動獲得 3.6.11。

https://docs.cloudfoundry.org/buildpacks/python/index.html#runtime

更改位於項目目錄中的 runtime.txt 文件中的 Python 版本解決了該問題。 Python安裝成功。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM