Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 405
Machine Learning Avatar asked Aug 28 '26 01:08

Machine Learning


2 Answers

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
like image 110
Raqib Avatar answered Aug 29 '26 17:08

Raqib


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

like image 28
mabergerx Avatar answered Aug 29 '26 17:08

mabergerx