nlp = spacy.load("en_core_web_sm")

Error found

OSError                                   Traceback (most recent call last)
<ipython-input-3-8d092272a28e> in <module>
----> 1 nlp = spacy.load("en_core_web_sm")

~\anaconda3\lib\site-packages\spacy\__init__.py in load(name, disable, exclude, config)
 45     RETURNS (Language): The loaded nlp object.
 46     """
---> 47     return util.load_model(name, disable=disable, exclude=exclude, config=config)
 48 
 49 

~\anaconda3\lib\site-packages\spacy\util.py in load_model(name, vocab, disable, exclude, config)
327     if name in OLD_MODEL_SHORTCUTS:
328         raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name]))
--> 329     raise IOError(Errors.E050.format(name=name))
330 
331 

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

Dani AI

Generated

Most likely cause: spaCy can't find the English model package in the Python environment that the Jupyter kernel is using. Common reasons are (1) the model was never installed, (2) it was installed into a different virtualenv/conda environment than the notebook kernel, or (3) a mismatch between the installed spaCy version and the model build.

Quick, practical checks and fixes (run these from inside the notebook so they use the same interpreter):

import sys, spacy
print(sys.executable)    # shows which Python the kernel is using
print(spacy.__version__) # confirm spaCy is imported from that environment

If the executable is not the expected env, install the model into that exact interpreter. From a terminal (or from the notebook using the same interpreter) run:

# ensure the install happens into the same Python you printed above
{path_to_python_from_sys_executable} -m pip install -U spacy
{path_to_python_from_sys_executable} -m spacy download en_core_web_sm

Alternatives: use conda install -c conda-forge spacy if managing environments with conda, or register the virtualenv/conda env as a Jupyter kernel via python -m ipykernel install --user --name myenv --display-name "Python (myenv)".

Further troubleshooting: list installed packages in that environment (pip list or conda list) and verify a spaCy model package appears; check spacy.util.is_package(...) if preferred. Note that 's pointer about model installs is relevant for environment issues, though the linked scispaCy discussion is specific to biomedical stacks and not required for loading the standard English model. Also, this is a Python/kernel issue rather than VB—so the VB tags can be removed (as suggested).

Recommended Answers

All 2 Replies

Is this Python? You tagged database python vb.net visual-basic xml. Should I untag this topic from being VB related?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.