1

I have tried all the previous solution provided but am not able to resolve the error.

The steps which I have followed.

Installation

pip install -U spacy

python -m spacy download en_core_web_sm

Then in jupyter notebook am running the following command.

import spacy

nlp = spacy.load('en_core_web_sm')

But it is not working and throwing the error.

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-1-6074c7bb959f> in <module>
      1 import spacy
      2 
----> 3 nlp = spacy.load('en_core_web_sm')

c:\users\satya\appdata\local\programs\python\python37\lib\site-packages\spacy\__init__.py in load(name, **overrides)
     28     if depr_path not in (True, False, None):
     29         warnings.warn(Warnings.W001.format(path=depr_path), DeprecationWarning)
---> 30     return util.load_model(name, **overrides)
     31 
     32 

c:\users\satya\appdata\local\programs\python\python37\lib\site-packages\spacy\util.py in load_model(name, **overrides)
    173     elif hasattr(name, "exists"):  # Path or Path-like to model data
    174         return load_model_from_path(name, **overrides)
--> 175     raise IOError(Errors.E050.format(name=name))
    176 
    177 

OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

I have tried this as well

import em_core_web_sm

nlp = em_core_web_sm.load()

and getting the following error.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-14ac18f40d90> in <module>
----> 1 import em_core_web_sm
      2 
      3 nlp = em_core_web_sm.load()

ModuleNotFoundError: No module named 'em_core_web_sm'

I tried to change path and all the other solutions as well but none of them is working.

How this can be resolved?

Satyam Anand
  • 479
  • 1
  • 5
  • 14
  • 2
    Your `pip` and `python` most likely are in different environments. Try installing spacy with `python -m pip install -U spacy` and then download with `python -m spacy download en_core_web_sm`. This will ensure that you're using the `pip` associated with `python`. – Michael Ruth Apr 23 '21 at 01:56
  • Tried this but it is not working. Am getting the same error. – Satyam Anand Apr 23 '21 at 02:06
  • Did the model download command produce any errors? – Michael Ruth Apr 23 '21 at 02:13
  • Yes, this is error am getting but after that model is downloading.2021-04-23 07:32:08.908952: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2021-04-23 07:32:08.909483: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. – Satyam Anand Apr 23 '21 at 02:21
  • Well there's your problem, you need to install the CUDA libraries referenced in the error – Michael Ruth Apr 23 '21 at 02:22
  • But if I do not want GPU acceleration then it should not be the problem as per this answer https://stackoverflow.com/a/59823284/12991246 – Satyam Anand Apr 23 '21 at 02:30
  • You don't need a GPU to use the small model in spaCy. It sounds like the python you're using to install may not be the same one your notebook is using. Can you run the download command in the notebook with a `!python -m spacy download ...` command? – polm23 Apr 23 '21 at 05:28

1 Answers1

0

"em_core_web_sm" should be replaced by "en_core_web_sm"