SpaCy OSError: Can't find model 'en'

前端 未结 12 1494
夕颜
夕颜 2020-12-23 16:11

even though I downloaded the model it cannot load it

[jalal@goku entity-sentiment-analysis]$ which python
/scratch/sjn/anaconda/bin/python
[jalal@goku entity         


        
相关标签:
12条回答
  • 2020-12-23 16:51

    oh well. turns out even though my which python was showing anaconda python, when I was using python download it was linking it to python2.7 local on my machine. I fixed it using below command:

    $ sudo /scratch/sjn/anaconda/bin/python -m spacy download en
    
    0 讨论(0)
  • 2020-12-23 16:56

    Since you are using python version 3.6, try using -

    python3 -m spacy download en

    instead of just python -m .....

    0 讨论(0)
  • 2020-12-23 16:57

    If you have already downloaded spacy and the language model (E.g., en_core_web_sm or en_core_web_md), then you can follow these steps:

    1. Open Anaconda prompt as admin

    2. Then type : python -m spacy link [package name or path] [shortcut]

      For E.g., python -m spacy link /Users/you/model en

    This will create a symlink to the your language model. Now you can load the model using spacy.load("en") in your notebooks or scripts

    0 讨论(0)
  • 2020-12-23 17:01

    Go to https://github.com/explosion/spacy-models

    Download the model you want to load in SpaCy

    Paste the downloaded file in SpaCy folder present inside the Anaconda folder

    open cmd there. Type the following command and hit enter:

    pip install en_core_web_md-1.2.0.tar.gz
    

    The above command may vary depending upon the version of the file downloaded.

    Voila! Error has gone :)

    0 讨论(0)
  • 2020-12-23 17:03

    FINALLY CLEARED THE ERROR !!!

    Always Open Anaconda Prompt / Command Prompt with Admin Rights to avoid Linking errors!!!

    • Tried multiple options including :

      python -m spacy download en

      conda install -c conda-forge spacy

      python -m spacy download en_core_web_sm

      python -m spacy link en_core_web_sm en

    • None worked since im using my Company's Network. Finally this Command Worked like a Charm :-)

      pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz --no-deps

      • Updated with Latest Link :

      pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz --no-deps

    Thanks to the Updated Github Links :-)

    0 讨论(0)
  • 2020-12-23 17:06

    By using sudo python ... you install the model for a different python interpreter than your local one. In fact, it says in your log that the spaCy model is installed to /usr/lib64/python2.7/site-packages/ instead of /scratch/sjn/anaconda/lib/python3.6/site-packages/.

    Try running python -m spacy download en and it should install the model to the correct directory.

    0 讨论(0)
提交回复
热议问题