0

I'm trying to use a spaCy model within an IBM Cloud deployed function and the installation of spacy fails without a specific error.

How to reproduce:

def dummy_deployable_function():
    try:
        import subprocess
        subprocess.check_output("pip install spacy --user", stderr=subprocess.STDOUT, shell=True)
    except subprocess.CalledProcessError as e: 
        install_err = "subprocess.CalledProcessError:\n\n" + "cmd:\n" + e.cmd + "\n\noutput:\n" + e.output.decode()
        raise Exception( "Installing failed:\n" + install_err )
    import spacy

    def score(payload):
        return payload["values"][0]
    return score

from watson_machine_learning_client import WatsonMachineLearningAPIClient
wml_credentials = { # not shown :-)
    "apikey": "", 
    "instance_id": "",
    "password": "",
    "url": "",
    "username": ""
}
client = WatsonMachineLearningAPIClient( wml_credentials )

# Store the function
meta_data = { client.repository.FunctionMetaNames.NAME : 'Dummy Model' }
function_details = client.repository.store_function( meta_props=meta_data, function=dummy_deployable_function )
function_id = function_details["metadata"]["guid"]
function_deployment_details = client.deployments.create( artifact_uid=function_id, name='Dummy Model Deployment')

The last line of the 'error' I'm receiving is just:

Installing collected packages: srsly, attrs, pyrsistent, jsonschema, wasabi, cymem, preshed, murmurhash, plac, blis, thinc, spacy

The exit code of pip is -9.

Any ideas (or alternative solutions) on how this problem can be solved? A lot of other packages (including all spacy dependencies) can be installed. Thanks for your help.

freecraver
  • 11
  • 2
  • -9 is SIGKILL... is it possible the machine the command is being run on is running out of memory, á la https://stackoverflow.com/questions/18529452/sudden-exit-with-status-of-9 ? – AKX Jul 10 '19 at 15:37
  • Sounds reasonable. I am going to check the memory restrictions. Thank you very much. – freecraver Jul 10 '19 at 15:41

1 Answers1

0

One thing you should try is installing the dependencies first with conda and then installing SpaCy.

So first go conda install -- <my packages>