【问题标题】:Installing spacy within Watson Machine Learning deployed function fails without error message在 Watson Machine Learning 部署的函数中安装 spacy 失败且没有错误消息
【发布时间】:2019-11-20 06:49:18
【问题描述】:

我正在尝试在 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:\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')

我收到的“错误”的最后一行是:

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

pip 的退出码是-9。

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

【问题讨论】:

标签: python ibm-watson spacy watson-studio


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-16
    • 1970-01-01
    相关资源
    最近更新 更多