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

I am trying to train the model but i am getting this error

Traceback (most recent call last):
  File "C:/Users/sanchit/PycharmProjects/chatbots/nlu_model.py", line 18, in <module>
    train_nlu("./data/data.json", "config_spacy.json", "./models/nlu")
  File "C:/Users/sanchit/PycharmProjects/chatbots/nlu_model.py", line 12, in train_nlu
    trainer = Trainer(config.load(config_file))
  File "C:\Users\sanchit\PycharmProjects\chatbots\venv\lib\site-packages\rasa_nlu\model.py", line 150, in __init__
    self.pipeline = self._build_pipeline(cfg, component_builder)
  File "C:\Users\sanchit\PycharmProjects\chatbots\venv\lib\site-packages\rasa_nlu\model.py", line 162, in _build_pipeline
    component = component_builder.create_component(component_cfg, cfg)
  File "C:\Users\sanchit\PycharmProjects\chatbots\venv\lib\site-packages\rasa_nlu\components.py", line 448, in create_component
    component_config, cfg)
  File "C:\Users\sanchit\PycharmProjects\chatbots\venv\lib\site-packages\rasa_nlu\registry.py", line 186, in create_component_by_config
    return component_class.create(component_config, config)
  File "C:\Users\sanchit\PycharmProjects\chatbots\venv\lib\site-packages\rasa_nlu\utils\spacy_utils.py", line 64, in create
    nlp = spacy.load(spacy_model_name, disable=['parser'])
  File "C:\Users\sanchit\PycharmProjects\chatbots\venv\lib\site-packages\spacy\__init__.py", line 27, in load
    return util.load_model(name, **overrides)
  File "C:\Users\sanchit\PycharmProjects\chatbots\venv\lib\site-packages\spacy\util.py", line 171, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

Process finished with exit code 1

You are using spacy in your pipeline components, but you did not download the corresponding spacy model. Take a look at Installation to get instructions on how to install the dependencies for spacy.

Thank for the replying Tanja, but i have already tried this. I think the problem is something else.

Hey BTW do you any trouble shooting for that error ValueError: dictionary update sequence element #0 has length 1; 2 is required

Can you please try the following? Open a terminal, open a python console (python) and execute:

import spacy

If you are using a virtualenv for rasa, please use that environment. Can the spacy model be loaded?

Regarding the other error: Can you please past the full stack trace?

Yeah Tanja that’s the issue when I am trying to run that command its giving me the first error

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

It might be the issue with my PC.

Can you load the “en_core_web_md” model (e.g. spacy.load("en_core_web_md"))? If yes, just the link is broken.

yes Tanja that command was working absolutely fine. So that means the link is broken . any suggestion how can I solve this?

Maybe this helps: python - Spacy link error - Stack Overflow or en model not loading · Issue #1283 · explosion/spaCy · GitHub

They suggest to run the link command as admin.

thanks Tanja i look into both of the answers that you have provided. I followed the github one. so as ines said on github import en_core_web_sm nlp = en_core_web_sm.load() Those commands were running successfully so it means the model was installed correctly. And I am still facing that issue. And yes I am running commands as Admin.

Not sure why it is not working. Did you already took a look at the documentation of spacy (https://spacy.io/usage/models#usage-link)? Otherwise, I would advise you to maybe ask the question on Newest 'spacy' Questions - Stack Overflow.

I have had some problem. I had realized that the spacy en_core_web_md model had not installed to venv lib file despite I had run the:

python -m spacy download en_core_web_md

python -m spacy link en_core_web_md en

codes. The solution is installing the models with admin privileges with sudo before the codes while the venv is activated.

I mean:

sudo python -m spacy download en_core_web_md

sudo python -m spacy link en_core_web_md en

Open command prompt or terminal and execute the below code:

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

Execute the below chunk in your Jupiter notebook.

import spacy

nlp = spacy.load('en_core_web_sm')

Hope the above code works for all:)