Machine Learning
Machine Learning

Reputation: 515

spacy model in cloud function not working

my requirements.txt

spacy

my cloud function code:

import spacy
nlp = spacy.load("en_core_web_sm")

the error:

Function failed on loading user code. Error message: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

Upvotes: 2

Views: 2579

Answers (2)

Raqib
Raqib

Reputation: 1442

Your requirements.txt should look like this. The https link will directly download the spacy model and install it when you install the dependencies from requirements.txt. The spaCy models are valid python packages. Check this link for more details.

spacy
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz#egg=en_core_web_sm

Upvotes: 8

mabergerx
mabergerx

Reputation: 1213

You need to download the spaCy English model. Follow the instructions at: https://spacy.io/usage/models#quickstart

Upvotes: 1

Related Questions