The basic installation includes all core dependencies needed for the main functionality:
pip install sntutilsThis installs:
- Data processing: pandas, numpy
- Web scraping: requests, beautifulsoup4, lxml
- Progress bars: tqdm
- String matching: python-Levenshtein
- CLI interface: rich (for better terminal output)
- Configuration: pyyaml (for config files)
To install with ALL optional dependencies for complete functionality:
pip install sntutils[all]This adds:
- Geospatial support: geopandas
- Excel files: openpyxl
- Parquet/Feather formats: pyarrow
- Advanced string matching: stringdist
- R file support: pyreadr
- CLI commands: click
pip install sntutils[geo]Includes: geopandas, shapely, fiona
pip install sntutils[excel]Includes: openpyxl, xlsxwriter
pip install sntutils[formats]Includes: pyarrow (Parquet/Feather), fastparquet, pyreadr (R RDS files)
pip install sntutils[dev]Includes: pytest, black, flake8, mypy, pre-commit, type stubs
pip install sntutils[docs]Includes: sphinx, sphinx-rtd-theme, myst-parser
You can combine multiple optional dependency groups:
# Install with geo and excel support
pip install sntutils[geo,excel]
# Install with all features plus dev tools
pip install sntutils[all,dev]git clone https://github.com/ahadi-analytics/sntutils-py.git
cd sntutils-py
pip install -e .
# Or with all optional dependencies
pip install -e ".[all]"
# Or for development
pip install -e ".[dev]"git clone https://github.com/ahadi-analytics/sntutils-py.git
cd sntutils-py
uv sync --dev # Installs all dev dependencies
uv pip install -e . # Editable installAfter installation, verify everything works:
# Test basic import
import sntutils
print(sntutils.__version__)
# Test CHIRPS functionality
from sntutils.climate import chirps_options
print(chirps_options())
# Test harmonization functionality
from sntutils.geo import prep_geonames
# prep_geonames is now availableIf you encounter messages like:
- "Warning: openpyxl not installed" - Install with
pip install sntutils[excel] - "Warning: pyarrow not installed" - Install with
pip install sntutils[formats] - GeoPandas errors - Install with
pip install sntutils[geo]
Some dependencies like geopandas may require additional steps on Windows:
# Install using conda first (recommended)
conda install geopandas
pip install sntutils
# Or use precompiled wheels
pip install pipwin
pipwin install gdal fiona
pip install sntutils[geo]If you encounter issues with GDAL:
brew install gdal
pip install sntutils[geo]Install system dependencies first:
# Ubuntu/Debian
sudo apt-get install gdal-bin libgdal-dev
# Fedora
sudo dnf install gdal gdal-devel
pip install sntutils[all]If you want the absolute minimum installation without even Rich or PyYAML:
pip install --no-deps sntutils
pip install requests pandas numpy beautifulsoup4 lxml tqdm python-LevenshteinTo check which optional features are available:
from sntutils.geo.harmonize_admin_names import RICH_AVAILABLE
print(f"Rich CLI: {RICH_AVAILABLE}")
# Check for Excel support
try:
import openpyxl
print("Excel support: Available")
except ImportError:
print("Excel support: Not installed")
# Check for geospatial support
try:
import geopandas
print("GeoPandas: Available")
except ImportError:
print("GeoPandas: Not installed")To update to the latest version:
pip install --upgrade sntutils
# Or with all features
pip install --upgrade sntutils[all]