Installation
OpenCLIP can be installed in multiple ways depending on your use case. This guide covers installation for inference, training, and development.Basic Installation
For inference and basic usage, install OpenCLIP via pip:The package name is
open_clip_torch on PyPI, but you import it as open_clip in Python.Optional Dependencies
Some models require additional packages depending on their architecture:Image Encoders (timm)
Many modern models use timm-based image encoders (ConvNext, SigLIP, EVA, etc.). Install the latest timm for full model support:Tokenizers (transformers)
Models that use Hugging Face transformers tokenizers require the transformers library:Complete Installation
To install OpenCLIP with all optional dependencies:Training Installation
For training CLIP models, install with training dependencies:- Distributed training
- Data loading and augmentation
- Logging and monitoring
- WebDataset support
Training requires PyTorch to be installed separately. Follow the PyTorch installation guide for your specific system configuration.
Development Installation
For contributors or those who want to modify the code:Testing Installation
To verify your installation and run tests:Install test dependencies
Run all tests
Run specific tests
Verification
Verify your installation by loading a pretrained model:Platform-Specific Notes
Linux
OpenCLIP works out of the box on most Linux distributions. For CUDA support, ensure you have:- NVIDIA drivers installed
- CUDA toolkit matching your PyTorch version
macOS
OpenCLIP works on macOS with CPU or MPS (Apple Silicon) acceleration:Windows
For Windows, we recommend using WSL2 (Windows Subsystem for Linux) for the best experience, especially for training. Native Windows installation works but may have some limitations.Troubleshooting
ImportError: cannot import name 'open_clip'
ImportError: cannot import name 'open_clip'
Make sure you’re importing the correct name:
CUDA out of memory errors
CUDA out of memory errors
Reduce batch size or use gradient accumulation:
'Unknown model' error
'Unknown model' error
This usually means a timm model is not found. Upgrade timm:
Slow model loading
Slow model loading
Models are cached after first download. The cache location can be set:
Next Steps
Now that OpenCLIP is installed, proceed to the quickstart guide to run your first example:- Quickstart Guide - Run zero-shot classification
- [Model Zoo(/usage/pretrained-models) - Browse available models
- [Training Guide(/training/overview) - Train your own CLIP models
