Can't find model 'en_core_web_md'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory
Asked Answered
R

3

11

I have installed spacy and downloaded en_core_web_sm with: pip install spacy python -m spacy download en_core_web_sm Also tried pip3 install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz

My spaCy version: 2.2.0 My Python version: 3.7.4

However, it still shows the error: OSError: [E050] Can't find model 'en_core_web_md'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

*import aqgFunction
import spacy
import en_core_web_sm
nlp = en_core_web_sm.load()
# Main Function
def main():
    # Create AQG object
    aqg = aqgFunction.AutomaticQuestionGenerator()
    inputTextPath = "E:\Automatic-Question-Generator-master\Automatic-Question-Generator-master\AutomaticQuestionGenerator\DB\db.txt"
    readFile = open(inputTextPath, 'r+', encoding="utf8")
    #readFile = open(inputTextPath, 'r+', encoding="utf8", errors = 'ignore')
    inputText = readFile.read()
    #inputText = '''I am Dipta. I love codding. I build my carrier with this.'''
    questionList = aqg.aqgParse(inputText)
    aqg.display(questionList)
    #aqg.DisNormal(questionList)
    return 0
# Call Main Function
if __name__ == "__main__":
    main()*
Rhinal answered 4/8, 2020 at 9:36 Comment(1)
FYI: the post title & description suggest there's a mismatch in small vs medium language model size between what was downloaded vs what was used.Thirtyeight
D
15

In Jupyter notebook use:

!python -m spacy download en_core_web_md 

then:

[Ctrl+M] or `Restart runtime` from menu bar
Denysedenzil answered 17/6, 2021 at 4:28 Comment(2)
also relevant for Jupiter Notebook over Google ColabStator
worked for me on the Colab as well.Prenotion
S
4

Try to use this to install spacy and the model:

pip3 install spacy
python3 -m spacy download en_core_web_sm

And then run these in a python console.

nlp = spacy.load("en_core_web_sm")
doc = nlp("Text here")
Scrimp answered 4/8, 2020 at 13:14 Comment(0)
S
0

I had this happen when I had installed en_core_web_md into a remote interpreter for a container, but then ran the file with if __name__ == '__main__', which used a venv where en_core_web_md wasn't available.

Shealy answered 29/10, 2021 at 19:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.