SpaCy OSError: Can't find model 'en'

前端 未结 12 1495
夕颜
夕颜 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 17:06

    I am using anaconda jupyter notebook and was getting same error. Ran below commands in anaconda prompt (run as administrator) and it resolved my issue:

    (base) C:\WINDOWS\system32>conda install -c conda-forge spacy
    Collecting package metadata (repodata.json): done
    Solving environment: done
    
    ## Package Plan ##
    
      environment location: C:\Users\yadav\Anaconda3
    
      added / updated specs:
        - spacy
    
    
    The following packages will be downloaded:
    
        package                    |            build
        ---------------------------|-----------------
        cymem-2.0.3                |   py37h6538335_0          35 KB  conda-forge
        cython-blis-0.4.1          |   py37hfa6e2cd_0         4.3 MB  conda-forge
        murmurhash-1.0.0           |   py37h6538335_0          17 KB  conda-forge
        plac-0.9.6                 |             py_1          18 KB  conda-forge
        preshed-3.0.2              |   py37h6538335_1          89 KB  conda-forge
        spacy-2.2.1                |   py37he980bc4_0         7.4 MB  conda-forge
        srsly-0.2.0                |   py37h6538335_0         189 KB  conda-forge
        thinc-7.1.1                |   py37he980bc4_0         1.4 MB  conda-forge
        wasabi-0.4.0               |             py_0          19 KB  conda-forge
        ------------------------------------------------------------
                                               Total:        13.4 MB
    
    The following NEW packages will be INSTALLED:
    
      cymem              conda-forge/win-64::cymem-2.0.3-py37h6538335_0
      cython-blis        conda-forge/win-64::cython-blis-0.4.1-py37hfa6e2cd_0
      murmurhash         conda-forge/win-64::murmurhash-1.0.0-py37h6538335_0
      plac               conda-forge/noarch::plac-0.9.6-py_1
      preshed            conda-forge/win-64::preshed-3.0.2-py37h6538335_1
      spacy              conda-forge/win-64::spacy-2.2.1-py37he980bc4_0
      srsly              conda-forge/win-64::srsly-0.2.0-py37h6538335_0
      thinc              conda-forge/win-64::thinc-7.1.1-py37he980bc4_0
      wasabi             conda-forge/noarch::wasabi-0.4.0-py_0
    
    
    Proceed ([y]/n)? Y
    
    
    Downloading and Extracting Packages
    cython-blis-0.4.1    | 4.3 MB    | ############################################################################ | 100%
    cymem-2.0.3          | 35 KB     | ############################################################################ | 100%
    srsly-0.2.0          | 189 KB    | ############################################################################ | 100%
    thinc-7.1.1          | 1.4 MB    | ############################################################################ | 100%
    plac-0.9.6           | 18 KB     | ############################################################################ | 100%
    spacy-2.2.1          | 7.4 MB    | ############################################################################ | 100%
    preshed-3.0.2        | 89 KB     | ############################################################################ | 100%
    wasabi-0.4.0         | 19 KB     | ############################################################################ | 100%
    murmurhash-1.0.0     | 17 KB     | ############################################################################ | 100%
    Preparing transaction: done
    Verifying transaction: done
    Executing transaction: done
    
    
    (base) C:\WINDOWS\system32>python -m spacy download en
    Collecting en_core_web_sm==2.2.0
      Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz (12.0MB)
         |████████████████████████████████| 12.0MB 409kB/s
    Requirement already satisfied: spacy>=2.2.0 in c:\users\yadav\anaconda3\lib\site-packages (from en_core_web_sm==2.2.0) (2.2.2)
    Requirement already satisfied: numpy>=1.15.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (1.16.2)
    Requirement already satisfied: thinc<7.4.0,>=7.3.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (7.3.1)
    Requirement already satisfied: wasabi<1.1.0,>=0.3.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.4.0)
    Requirement already satisfied: requests<3.0.0,>=2.13.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (2.21.0)
    Requirement already satisfied: setuptools in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (40.8.0)
    Requirement already satisfied: plac<1.2.0,>=0.9.6 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (1.1.3)
    Requirement already satisfied: srsly<1.1.0,>=0.1.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.2.0)
    Requirement already satisfied: cymem<2.1.0,>=2.0.2 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (2.0.3)
    Requirement already satisfied: importlib-metadata>=0.20; python_version < "3.8" in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.23)
    Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (1.0.2)
    Requirement already satisfied: blis<0.5.0,>=0.4.0 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (0.4.1)
    Requirement already satisfied: preshed<3.1.0,>=3.0.2 in c:\users\yadav\anaconda3\lib\site-packages (from spacy>=2.2.0->en_core_web_sm==2.2.0) (3.0.2)
    Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in c:\users\yadav\anaconda3\lib\site-packages (from thinc<7.4.0,>=7.3.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (4.36.1)
    Requirement already satisfied: certifi>=2017.4.17 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (2019.3.9)
    Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (1.24.1)
    Requirement already satisfied: idna<2.9,>=2.5 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (2.8)
    Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\yadav\anaconda3\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.0->en_core_web_sm==2.2.0) (3.0.4)
    Requirement already satisfied: zipp>=0.5 in c:\users\yadav\anaconda3\lib\site-packages (from importlib-metadata>=0.20; python_version < "3.8"->spacy>=2.2.0->en_core_web_sm==2.2.0) (0.6.0)
    Requirement already satisfied: more-itertools in c:\users\yadav\anaconda3\lib\site-packages (from zipp>=0.5->importlib-metadata>=0.20; python_version < "3.8"->spacy>=2.2.0->en_core_web_sm==2.2.0) (6.0.0)
    Building wheels for collected packages: en-core-web-sm
      Building wheel for en-core-web-sm (setup.py) ... done
      Created wheel for en-core-web-sm: filename=en_core_web_sm-2.2.0-cp37-none-any.whl size=12019131 sha256=f716e80f029462a80e9fb79ef353c1ac8c0f81d3754778bb6fec520d640fcc87
      Stored in directory: C:\Users\yadav\AppData\Local\Temp\pip-ephem-wheel-cache-bvy0x0eg\wheels\48\5c\1c\15f9d02afc8221a668d2172446dd8467b20cdb9aef80a172a4
    Successfully built en-core-web-sm
    Installing collected packages: en-core-web-sm
      Found existing installation: en-core-web-sm 2.0.0
        Uninstalling en-core-web-sm-2.0.0:
          Successfully uninstalled en-core-web-sm-2.0.0
    Successfully installed en-core-web-sm-2.2.0
    ✔ Download and installation successful
    You can now load the model via spacy.load('en_core_web_sm')
    symbolic link created for C:\Users\yadav\Anaconda3\lib\site-packages\spacy\data\en <<===>> C:\Users\yadav\Anaconda3\lib\site-packages\en_core_web_sm
    ✔ Linking successful
    C:\Users\yadav\Anaconda3\lib\site-packages\en_core_web_sm -->
    C:\Users\yadav\Anaconda3\lib\site-packages\spacy\data\en
    You can now load the model via spacy.load('en')
    
    (base) C:\WINDOWS\system32>
    

    Then in jupyter notebook load it like below:

    nlp = spacy.load('en',parse=True,tag=True, entity=True)
    
    0 讨论(0)
  • 2020-12-23 17:12

    As you are using Anaconda, open Anaconda Prompt as an Admin and execute the following command

    python -m spacy download en
    

    To load Spacy 'en' in Jupyter Notebook use the following command

    spacy.load('en')
    
    0 讨论(0)
  • 2020-12-23 17:14

    If you use other python version, you can run :

    sudo python3.6 -m spacy download en

    With me, my version 3.6 I hope it can help your problem!

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

    Bc i didnt find my error here (For everyone who uses jupyter Notebook, Alteryx, Company Network and had this error):

    i tried to create a macro with python for topic detection but got the Error that there is not a module named "en_core_web_sm"

    Install following Packages at the beginning with following code:

    from ayx import Package Package.installPackages(['pandas','numpy', 'matplotlib', 'gensim', 'spacy', 'pyLDAvis', 'https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz'])

    And if you are referencing to the module use:

    import en_core_web_sm

    nlp = en_core_web_sm.load()

    worked for me perf fine :))

    0 讨论(0)
  • 2020-12-23 17:16
      pip 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
    
      #fixes an permission error when attempting to create the symlinks on windows 10
    
      python -m spacy link en_core_web_sm en_core_web_smc
    
      from Jupyter notes
      import spacy
    
      nlp = spacy.load('en_core_web_sm')
    
    0 讨论(0)
  • 2020-12-23 17:17

    1) Install Spacy

    $ python -m spacy download en
    

    2) Install the model en_core_web_sm

    $ python -m spacy download en_core_web_sm
    >>> import spacy
    >>> nlp = spacy.load("en_core_web_sm")
    
    0 讨论(0)
提交回复
热议问题