Member-only story
How to download spaCy models in a Poetry managed environment
I start learning Natural Language Processing (NLP) libraries like spaCy and since I was using Poetry
for dependency management and was quite new to it, I encountered some troubles when adding spaCy models. I am writing this mainly for my future self as a reminder of the steps needed.
Step 1: Find the latest model you need to add
You can find the latest model in spacy-models
repository, for example I was about to download en_core_web_sm
which is a small English pipeline that supports all core capabilities and is trained on web text.
Once you find the model you need, scroll down to the Assets section and copy the link with .tar.gz
extension.
Step 2: Update your TOML file
Now in your toml file under [tool.poetry.dependencies]
add the name of the model ( ex. en_core_web_sm
) with following format
[tool.poetry.dependencies]
python = "^3.12"
black = "^24.2.0"
spacy = "^3.7.4"
en_core_web_sm = {url =…