Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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()*
like image 591
Rajni Arora Avatar asked Aug 04 '20 09:08

Rajni Arora


People also ask

How do I manually install a spacy model?

To download and install the models manually, unpack the archive, drop the contained directory into spacy/data and load the model via spacy. load('en') or spacy.

How do I install a spacy model in Pycharm?

Click the Python Interpreter tab within your project tab. Click the small + symbol to add a new library to the project. Now type in the library to be installed, in your example "spacy" without quotes, and click Install Package . Wait for the installation to terminate and close all popup windows.

Where is spacy model stored?

You can place the model data directory anywhere on your local file system. To use it with spaCy, simply assign it a name by creating a shortcut link for the data directory.


2 Answers

In Jupyter notebook use:

!python -m spacy download en_core_web_md 

then:

[Ctrl+M] or `Restart runtime` from menu bar
like image 129
Talha Tayyab Avatar answered Sep 18 '22 10:09

Talha Tayyab


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")
like image 39
Jeffrey Hiraki Avatar answered Sep 19 '22 10:09

Jeffrey Hiraki