. Advertisement .
. Advertisement .
If you have suddenly started getting the error “OSError: [E050] Can’t find model ‘en_core_web_sm’”, then it can be a real nightmare. The problem seems to appear out of nowhere and no amount of troubleshooting seems to fix it. Here is one of the most effective ways to fix this error. Read on.
How To Fix The Error “OSError: [E050] Can’t find model ‘en_core_web_sm’”?
You are attempting to use spacy as shown below.
However, you can experience the following issue.
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.
In our case, we simply executed this command, and my problem was resolved. Start executing this command. python -m spacy download en. The second option is assigning the full path where en_core_web_sm is downloaded. Here’s how to do it.
Option 1: Simply utilizing the following command
In our case, we simply executed this command, and my problem was resolved. Start executing this command.
python -m spacy download en
Option 2: Import like this
Simply import en_core_web_sm, like this.
import en_core_web_sm nlp = en_core_web_sm.load()
Option 3: Give spacy.load the whole path.
You should assign the full path where en_core_web_sm is downloaded. Here’s how to do it.
In our situation, the downloaded path for en_core_web_sm is: C:\Users\ssc\AppData\Local\Continuum\anaconda3\Lib\site-packages\en_core_web_sm\en_core_web_sm-2.2.0.
nlp = spacy.load(r'C:\Users\ssc\AppData\Local\Continuum\anaconda3\Lib\site-packages\en_core_web_sm\en_core_web_sm-2.2.0')
We hope you enjoyed our blog post on how to solve the bug “OSError: [E050] Can’t find model ‘en_core_web_sm’”. Please leave a comment if you have any further questions or concerns regarding this topic. Thank you for taking the time to read; we are always delighted anytime one of our pieces can give important information on this topic!