0

Importing pynacl crashes when I upload a python zip to IBM Cloud Functions. Is that because it has C code instead of being pure python? How can I get around this?

Russell
  • 21
  • 2

1 Answers1

1

When also I tried to create a python zip action using virtualenv I get an error about make raise Exception("ERROR: The 'make' utility is missing from PATH") Exception: ERROR: The 'make' utility is missing from PATH

The good news is that IBM Cloud Functions released a new Python 3 images based on Ubuntu/Debian, with kind python-jessie:3

I tried the following and was able to create a python action with virtualenv using the docker image ibmfunctions/action-python-v3 and install nacl package with no errors.

$ cat __main__.py

import nacl.bindings as b
import nacl.exceptions as exc

def main(args):
    name = args.get("name", "stranger")
    greeting = "Hello " + name + "!"
    print(greeting)
    return {"greeting": greeting}

$ cat requirements.txt
pynacl
$ docker run --rm -v "$PWD:/tmp" ibmfunctions/action-python-v3 bash  -c "cd tmp && virtualenv virtualenv && source virtualenv/bin/activate && pip install -r requirements.txt"
$ zip -r nacl.zip virtualenv __main__.py
$ bx wsk action update python3ibm nacl.zip --kind python-jessie:3

More details on python runtimes check out the docs here https://console.bluemix.net/docs/openwhisk/openwhisk_reference.html#openwhisk_ref_python_environments

csantanapr
  • 5,002
  • 2
  • 19
  • 15