在 Watson Machine Learning 部署函数中安装 spacy 失败,且不显示错误消息



我正在尝试在 IBM Cloud 部署的功能中使用 spaCy 模型,但 spacy 的安装失败而没有特定错误。

如何复制:

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:nn" + "cmd:n" + e.cmd + "nnoutput: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')

我收到的"错误"的最后一行只是:

安装收集的软件包:srsly,attrs,pyrsistent,jsonschema,wasabi,cymem,preshed,murmurhash,plac,blis,thinc,spacy

pip 的退出代码是 -9。

关于如何解决这个问题的任何想法(或替代解决方案(?可以安装许多其他软件包(包括所有空间依赖项(。感谢您的帮助。

您应该尝试的一件事是先使用 conda 安装依赖项,然后安装 SpaCy。

所以先去conda install -- <my packages>

相关内容

最新更新