vmware-archive / kubeless

Kubernetes Native Serverless Framework
https://kubeless.io
Apache License 2.0
6.86k stars 754 forks source link

How are dependencies added/ supported ? #904

Open sbianu opened 6 years ago

sbianu commented 6 years ago

Is this a BUG REPORT or FEATURE REQUEST?: more of a feature request, or a clarification

What happened: I am trying to test kubeless integration with a popular machine learning api(Algorithmia), but the pod crashes on deployment. (using the kubeless ui forit, with Python 3.6)

Are there restrictions in terms of the outside libraries that can be used as dependencies? If so, how to add non-basic libraries as dependencies? Are there other requirements other that they need to be installed via PiPy for python? What about for the other languages supported?

What you expected to happen: Since Algorithmia is easily installable via PiPy, I thought that giving the name of the package in the dependencies would be enough to be able to use it in a function.

How to reproduce it (as minimally and precisely as possible): create new function in kubeless ui in dependencies add 'algorithmia' image

The usual way to install the package via pip is: pip install algorithmia more info about in on https://github.com/algorithmiaio/algorithmia-python

Anything else we need to know?: You guys did a great job so far!

Environment:

andresmgot commented 6 years ago

Hi @sbianu,

Probably the failure is not related to the installation of the package (unless it requires some system libraries not installed by default). You can find more information about why the function is crashing if you execute kubectl logs -l function=<func_id>. You can find more info about how to debug functions here: https://kubeless.io/docs/debug-functions/

sbianu commented 6 years ago

Hi @andresmgot ,

Thanks for the advice. After re-checking, you were right, indeed. There are some system libraries not installed by default as requirements, namely requests. With this in mind, I made the appropriate modifs, and the function is deployed successfully for the Python 3.4 and Python 2.7. Oddly enough, it still does not work for Python 3.6.

image

Bringing up the logs:

$ kubectl logs -l function=algo36 Traceback (most recent call last): File "/kubeless.py", line 4, in import imp File "/opt/bitnami/python/lib/python3.6/imp.py", line 27, in import tokenize File "/opt/bitnami/python/lib/python3.6/tokenize.py", line 33, in import re File "/opt/bitnami/python/lib/python3.6/re.py", line 142, in class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag'

Any ideas would be helpful :)

andresmgot commented 6 years ago

It seems that the module is not compatible with Python 3.6. As suggested in https://stackoverflow.com/questions/43124775/why-python-3-6-1-throws-attributeerror-module-enum-has-no-attribute-intflag you can try to install the module enum-compat or check if any of your dependencies is installing enum34.