I would like to push a simple Flask app to IBM cloud by using the following command:
%%bash
cd /resources/labs/CV0101EN/CV0101EN-capstone-project/app
ibmcloud app push
Unfortunately I receive an error during the process. By looking at the error I assume that for some reason, there was a problem with python installation, but I have no clue what is the cause of that. Does anyone know where is the issue here ? I would be grateful for any advice.
Installation log:
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
Below is the error that appears in my Jupiter notebook.
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.
Due to size limitations, buildpacks cannot contain all versions of Python ever created. As you can see in the output, the buildpack is telling you the version you requested and which versions are supported.
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]
The short answer is that you need to specify a version in runtime.txt
that is in the list of supported versions. That could be 3.6.9
or 3.6.10
.
A better solution though is to not specify a specific version, and to specify a branch. If you were to set 3.6.x
then you won't encounter this problem again in 2 months when 3.6.9 is no longer supported by the buildpack (buildpacks are constantly upgrading dependencies so you get the latest security & bug fixes).
With 3.6.x
, you will just get the latest version of the 3.6 branch that is supported by the buildpack. In the example above, that would result in 3.6.10 being installed. In two months when there is a 3.6.11, you'll automatically get 3.6.11.
https://docs.cloudfoundry.org/buildpacks/python/index.html#runtime