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

Viewed 15195

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()*
4 Answers

In Jupyter notebook use:

!python -m spacy download en_core_web_md 

then:

[Ctrl+M] or `Restart runtime` from menu bar

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")

If you are getting any errors like

"ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\Users\ttayyab\Anaconda3\Lib\site-packages\~rsly\msgpack\_packer.cp38-win_amd64.pyd' Consider using the --user option or check the permissions."

To install spacy on Windows 10, open your Anaconda prompt or Command prompt

    pip install spacy --user
    python -m spacy download en_core_web_sm      #for small
    python -m spacy download en_core_web_md      #for medium  
    python -m spacy download en_core_web_lg      #for large  

link to the official page https://spacy.io/api/cli#download

@Rajni Arora, you need to download en_core_web_md

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.

Related