-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing models using pip: improve documentation #1099
Comments
Thanks – and sorry about the confusion. I agree, this should definitely be more clear! The standard way of installing packages specified in the Alternatively, pip also lets you specify URLs and other sources in the requirements – see here for more info and examples. So instead of only the package name, you can add the URLs of the models you want to install. This won't run any spaCy internals like import en_core_web_sm
nlp = en_core_web_sm.load() In general, we do recommend this syntax for larger code bases because it doesn't depend on symlinks, and is cleaner and more "native" – for example, if a model package is not installed, Python will raise an So if specifying models in your TL;DR Adding the model URL instead of the package name to your |
Thank you, this is very clear! |
Yes, |
Very clear indeed! Now I'm wondering if there's a simple equivalent for setup.py We used a call to spacy.en.download in our setup.py to install the required modules, I believe the practice is deprecated or frowned upon. |
@lalvarezguillen I think you might be looking for a solution like this: https://stackoverflow.com/a/3481388/6400719
In theory, you could still use Btw, in spaCy v2.x, another option could be to simply package the models with your application. The new alpha models are only 12 and 15 MB – about the size of the spaCy package, and probably smaller than many other random pip packages. Edit: Just to clarify, this approach would be mostly for internal production use – not if you're actually distributing your package on PyPi or GitHub. While the model licenses (CC BY-SA) allow redistribution, we don't want to encourage people to reupload and mirror the official spaCy models. After all, they're just binary data and we want to make sure that there's only one official distribution. This makes things safer and less confusing for everyone. |
For python newbies like me. To add a model to
|
Not sure why but I added the model to my Pipfile, updated the lock file, but spacy doesn't appear to be working. Right now my Pipfile looks like this:
and my import and package loading looks like this:
my print statements look like this: but when I actually process text or do anything with the nlp object...nothing happens. It might be tokenizing the text but not much else. If I pass text in with (Apologies if this is in the wrong place or I should have made a new issue. If so let me know and I'll do so.) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Right now, my package has spaCy as a requirement in
requirements.txt
, andpython -m spacy download en
is run as part of the installation process.According to the documentation, models can be listed in
requirements.txt
, but no example is given. How can I add arequirements.txt
entry to just install the default English models?And is this enough, or will I then also need to run
python -m spacy link
or something?The text was updated successfully, but these errors were encountered: