{"id":22452,"library":"terratorch","title":"TerraTorch","description":"TerraTorch is a geospatial foundation model fine-tuning toolkit built on PyTorch Lightning, supporting models like Prithvi, DOFA, and others. The current version is 1.2.6, with active development and monthly releases.","status":"active","version":"1.2.6","language":"python","source_language":"en","source_url":"https://github.com/terrastackai/terratorch","tags":["geospatial","deep learning","fine-tuning","remote sensing","PyTorch"],"install":[{"cmd":"pip install terratorch","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core deep learning framework","package":"torch","optional":false},{"reason":"PyTorch Lightning for training loops","package":"lightning","optional":false},{"reason":"Geospatial datasets and transforms","package":"torchgeo","optional":false},{"reason":"Parameter-Efficient Fine-Tuning (LoRA, etc.)","package":"peft","optional":false}],"imports":[{"note":"TerraTorchTrainer is now exposed at the top level.","wrong":"from terratorch.trainer import TerraTorchTrainer","symbol":"TerraTorchTrainer","correct":"from terratorch import TerraTorchTrainer"},{"note":"Models are in the `models` module.","wrong":"from terratorch.backbones import PrithviModel","symbol":"PrithviModel","correct":"from terratorch.models import PrithviModel"}],"quickstart":{"code":"from terratorch import TerraTorchTrainer\nfrom terratorch.datamodules import GeoSpatialDataModule\nimport os\n\ntrainer = TerraTorchTrainer(\n    model_name='prithvi_eo_v2_300',\n    backbone='prithvi_eo_v2_300',\n    num_classes=10,\n    learning_rate=1e-4,\n)\ndatamodule = GeoSpatialDataModule(\n    data_root=os.environ.get('DATA_ROOT', './data'),\n    batch_size=4,\n)\ntrainer.fit(datamodule=datamodule)","lang":"python","description":"Minimal example fine-tuning a Prithvi model."},"warnings":[{"fix":"Use `from terratorch.models import PrithviModel` instead of `from terratorch.backbones import ...`.","message":"In v1.0, the import path for models changed from `terratorch.backbones` to `terratorch.models`. Old imports will fail.","severity":"breaking","affected_versions":">=1.0"},{"fix":"List available models via `terratorch.models.list_models()` and use the exact string.","message":"`TerraTorchTrainer` requires a `model_name` that exactly matches a registered model key. Typos silently fall back to a default, causing unexpected behavior.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install terratorch` and ensure you're using Python >=3.10.","cause":"Library not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'terratorch'"},{"fix":"Upgrade to the latest version: `pip install --upgrade terratorch`.","cause":"Using an older version (<1.0) where the class was nested.","error":"AttributeError: module 'terratorch' has no attribute 'TerraTorchTrainer'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}