Beginner
Installing spaCy
Get spaCy installed, download language models, and verify your setup in minutes.
Install with pip
Terminal — pip install
# Install spaCy
pip install spacy
# Download an English model
python -m spacy download en_core_web_sm # Small (12 MB)
python -m spacy download en_core_web_md # Medium (40 MB)
python -m spacy download en_core_web_lg # Large (560 MB)
python -m spacy download en_core_web_trf # Transformer-based
Model Sizes Compared
| Model | Size | Vectors | Accuracy | Speed | Best For |
|---|---|---|---|---|---|
| en_core_web_sm | 12 MB | No word vectors | Good | Fastest | Prototyping, basic NER |
| en_core_web_md | 40 MB | 20k vectors | Better | Fast | Similarity, general use |
| en_core_web_lg | 560 MB | 685k vectors | Best (CNN) | Moderate | Production, similarity |
| en_core_web_trf | 438 MB | Context vectors | Best overall | Slow (GPU) | Max accuracy |
Install with GPU Support
Terminal — GPU setup
# Install with CUDA support (for transformer models)
pip install spacy[cuda12x]
# Or for specific CUDA version
pip install spacy[cuda11x]
# Verify GPU is available
python -c "import spacy; spacy.prefer_gpu(); print('GPU enabled')"
Verify Installation
Python — Quick verification
import spacy
# Check version
print(f"spaCy version: {spacy.__version__}")
# Load model and test
nlp = spacy.load("en_core_web_sm")
doc = nlp("spaCy is an amazing NLP library!")
# Print tokens with their attributes
for token in doc:
print(f"{token.text:12} {token.pos_:6} {token.dep_:10} {token.lemma_}")
# Validate full installation
spacy.cli.validate()
Recommendation: Start with
en_core_web_sm for development and switch to en_core_web_lg or en_core_web_trf for production. The small model is fast to download and good enough for learning.
Lilly Tech Systems