Search code examples
pythonibm-cloudibm-watsonopenwhiskibm-cloud-functions

How can i install custom third party library in IBM Cloud functions action custom package?


I would like to use LanguageTranslatorV3 and ToneAnalyzerV3 python library in IBM Cloud function custom serverless action.

I created one sample Action in IBM Cloud function and try to import the above packages, but It gives me module error.

So, How can I install the above modules in my custom action?

Thanks in advance.


Solution

  • That process of integrating third party libraries is described in the IBM Cloud Functions documentation as part of preparing apps for actions. For Python you could use zip to package the environment, either with or without using virtualenv. Another option for even more complex environments could be to use a Docker image.

    The function in this tutorial-related repo uses the zip-approach.

    Many packages are already available in the standard Python runtime environments. Be sure to specify the right runtime version when creating the action.