fairing icon indicating copy to clipboard operation
fairing copied to clipboard

docker created from fairing uses python2 even base docker image has python 3 as default

Open Akashdesarda opened this issue 5 years ago • 4 comments

/kind bug

What steps did you take and what happened: I am using Trainjob API to deploy and run it remotely on GKE cluster. Following is the flow:

  1. After running Trainjob API it is first creating docker (working correctly)
  2. Then copying all the necessary dependencies and packaging it with docker (I am still not sure about this step) 3.Then pushing docker to specified registry (working correctly)
  3. Then using the same docker to run it on GKE cluster (from here the problem starts) In step no 4 folling is the problem
Traceback (most recent call last):
  File "/app/function_shim.py", line 4, in <module>
    from enum import Enum
ImportError: No module named enum
```   
I looked up the problem & following is conclusion:
1. enum package generally gives problem in python2
2. So I made sure my base docker image will use python3 as default. So should the docker generated step 2, but I think this is not the case. 

**What did you expect to happen:**
Function inside the docker should work just like the function working locally. 

**Anything else you would like to add:**
Docker generated in step 2 i.e. by Faring should use python3 by default 
I think so make change in Docker command python to python3.  (below log may help)
`Docker command: ['python', '/app/function_shim.py', '--serialized_fn_file', '/app/pickled_fn.p']`



**Environment:**

- Fairing version: 0.5.3
- Kubeflow version: 0.5

Akashdesarda avatar Jul 31 '19 11:07 Akashdesarda

Issue-Label Bot is automatically applying the label kind/bug to this issue, with a confidence of 0.96. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Jul 31 '19 11:07 issue-label-bot[bot]

@Akashdesarda Pls see my suggestion in the https://github.com/kubeflow/fairing/pull/333 thanks.

jinchihe avatar Aug 06 '19 03:08 jinchihe

Ok so it is because the environment in which fairing code is running, python is pointing to python2. Yes, @jinchihe suggestion to make python point to python3 will solve this issue.

shikha130vv avatar Aug 06 '19 10:08 shikha130vv

/priority p2 /area engprod

jtfogarty avatar Jan 15 '20 22:01 jtfogarty