This project fixes dependency conflicts between Algolia Python SDK and AWS S3 packages (boto3/botocore) in a FastAPI backend application.
The issue occurs during pip install, where Algolia Python SDK and AWS S3 packages (boto3/botocore) conflict and fail to install correctly.
Dependency conflicts have been resolved by:
- Pinning compatible versions of core dependencies
- Ensuring urllib3, requests, and certifi versions are compatible across both packages
- Using version ranges that allow flexibility while maintaining compatibility
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtuvicorn main:app --reloadThe API will be available at http://localhost:8000
API documentation: http://localhost:8000/docs
Copy env.example to .env and fill in your credentials:
cp env.example .env- FastAPI: >=0.104.0
- Algolia SDK: >=3.1.0,<4.0.0
- boto3: >=1.28.0,<2.0.0
- botocore: >=1.31.0,<2.0.0
- urllib3: >=1.26.0,<3.0.0 (shared dependency)
- requests: >=2.31.0,<3.0.0 (shared dependency)
These versions have been tested and verified to work together without conflicts.
Test that both services can be imported:
from services.algolia_service import AlgoliaService
from services.s3_service import S3ServiceBoth imports should work without errors.
fastapi-dependency-fix/
├── main.py # FastAPI application
├── services/ # Service integrations
│ ├── __init__.py
│ ├── algolia_service.py # Algolia service
│ └── s3_service.py # AWS S3 service
├── requirements.txt # Resolved dependencies
├── env.example # Environment variables template
└── README.md # This file