{"id":24442,"library":"python-cmr","title":"python-cmr","description":"Python wrapper to the NASA Common Metadata Repository (CMR) API. Version 0.13.0, supports Python 3.8-3.12. Active development, irregular releases.","status":"active","version":"0.13.0","language":"python","source_language":"en","source_url":"https://github.com/nasa/python_cmr","tags":["nasa","cmr","metadata","earthdata","api-wrapper"],"install":[{"cmd":"pip install python-cmr","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"HTTP client for CMR API calls","package":"requests","optional":false},{"reason":"Date parsing for temporal queries","package":"python-dateutil","optional":false},{"reason":"Python 2/3 compatibility","package":"six","optional":true}],"imports":[{"note":"Primary class for querying CMR. Often mistakenly imported from 'pycmr' or 'python_cmr'.","wrong":"","symbol":"CMR","correct":"from cmr import CMR"},{"note":"Use GranuleQuery, not Granule; the class name is explicit.","wrong":"from cmr import Granule","symbol":"GranuleQuery","correct":"from cmr import GranuleQuery"},{"note":"CollectionQuery for collections. Not Collection.","wrong":"","symbol":"CollectionQuery","correct":"from cmr import CollectionQuery"}],"quickstart":{"code":"from cmr import CMR\n# Initialize CMR client with optional auth\ncmr = CMR(environment='prod')\n# Search for collections\ncollections = cmr.collection_query().keyword('temperature').get()\nprint(collections[:2])\n# Search for granules\ngranules = cmr.granule_query().short_name('MOD11A1').get()\nprint(granules[:2])","lang":"python","description":"Basic usage: instantiate CMR client, run collection or granule query, get results."},"warnings":[{"fix":"Use `collections[0]['meta']['concept-id']` instead of `collection.concept_id`.","message":"Calls to `.get()` return raw JSON, not Python objects. Access fields via dictionary keys.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to latest version; if you rely on v3 specific features, pin to <0.10.0.","message":"CMR API v3 was deprecated in python-cmr 0.10.0; v3 endpoints may be removed in future releases.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Explicitly set `CMR(environment='uat')` for test environment.","message":"Environment parameter in CMR() defaults to 'prod'. Use 'uat' for testing. Mixing up environments causes empty results or auth errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `cmr.search_collections(...)` with `cmr.collection_query().filter(...).get()`.","message":"The `CMR().search_collections()` method is deprecated in favor of `CMR().collection_query().get()`.","severity":"deprecated","affected_versions":">=0.12.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install python-cmr` and ensure your Python environment is correct.","cause":"Virtual environment not activated or package not installed.","error":"ImportError: No module named cmr"},{"fix":"Use `cmr.collection_query().get()` instead.","cause":"Deprecated method removed in newer version.","error":"AttributeError: 'CMR' object has no attribute 'search_collections'"},{"fix":"Set environment variables `CMR_USERNAME` and `CMR_PASSWORD`, or pass `token` to CMR().","cause":"Missing or invalid Earthdata Login credentials for restricted data.","error":"cmr.errors.CMRException: HTTP 401 Unauthorized"},{"fix":"Use lowercase: 'prod', 'uat', or 'ops'.","cause":"Case-sensitive environment name.","error":"ValueError: Invalid environment 'prod'. Must be one of: 'prod', 'uat', 'ops'."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}