Member-only story

How to download spaCy models in a Poetry managed environment

Emad Dehnavi
3 min readMar 1, 2024

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.

Photo source: https://spacy.io/usage/spacy-101

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 =…

--

--

Emad Dehnavi
Emad Dehnavi

Written by Emad Dehnavi

With 8 years as a software engineer, I write about AI and technology in a simple way. My goal is to make these topics easy and interesting for everyone.

No responses yet