Marcos Silva
Marcos Silva

Reputation: 2029

Running Jupyter Notebook on Binder with spacy dependencies

I want to try out spacy in a Jupyter Notebook using Binder. When trying to run load on a model like:

nlp = en_core_web_sm.load()

I get the following error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-8a5aa70d40b9> in <module>
----> 1 import en_core_web_sm
      2 nlp = en_core_web_sm.load()

ModuleNotFoundError: No module named 'en_core_web_sm'

I tried downloading the model using the requirements.txt, but that didn't work or the model was download in an area I don't have access to. Not sure.

Here's the Github repo. Thank you.

Upvotes: 1

Views: 213

Answers (2)

Wayne
Wayne

Reputation: 9954

It looks like you are trying to use environment.yml and requirements.txt. When your needs necessitate moving beyond a requirements.txt configuration file for Binderhub-served sessions, you should move the contents of requirements.txt to environment.yml following this example repo. In your case though one of your current requirements.txt lines is redundant (and conflicting) with the spacy line in environment.yml.

Upvotes: 1

Sofie VL
Sofie VL

Reputation: 3106

spaCy models are not installed using the requirements.txt. You have to install them in your environment by running

python -m spacy download en_core_web_sm

For more information, see https://spacy.io/usage/models.

Upvotes: 0

Related Questions