--- id: codecarbon version: "3.3.0" license: MIT license_treatment: permissive maintenance: active --- # codecarbon License: permissive · Maintenance: active · Downloads: 204.8K/mo ## What it is and what it does CodeCarbon is a Python library that estimates the carbon emissions produced by your local computing hardware. It measures or estimates power consumption from CPU, GPU, and RAM, then applies the regional carbon intensity of your electricity grid to calculate CO₂ emissions in kilograms. The library offers both a programmatic API (via EmissionsTracker) and a command-line interface for tracking emissions without modifying code. It's designed for developers and researchers who want to understand and reduce the environmental footprint of their computational work—particularly useful for machine learning experiments, data processing, and other CPU- or GPU-intensive tasks. The package integrates with a web dashboard for visualization and provides configuration through files, environment variables, or Python arguments. Use it for: - Measure carbon emissions from training machine learning models to compare efficiency across different architectures or hyperparameters - Track total CO₂ impact of long-running data processing or scientific computing jobs to report environmental metrics - Monitor GPU utilization and emissions during development to identify and optimize energy-intensive code paths - Establish baseline carbon footprint for a research project and track improvements over time - Generate emissions reports for sustainability reporting or academic papers on green computing ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Measures and tracks carbon emissions from local computing hardware (CPU, GPU, RAM) and provides estimates of their environmental impact based on regional electricity carbon intensity. Yes, if you need to measure and track carbon emissions from local computing. The library is actively maintained, has no known vulnerabilities, installs easily, and uses a permissive MIT license. It fills a specific niche—local hardware emissions tracking—and is complementary to tools that track remote API calls. Install it if environmental impact of your code matters to your workflow or reporting requirements. ## Install pip install codecarbon uv add codecarbon poetry add codecarbon ## Installing codecarbon Before you install: Low friction install with a pure Python wheel. Actively maintained with a recent release; last commit within days. Supports modern Python versions (3.10–3.14). Sixteen runtime dependencies are manageable but add some weight to the dependency tree. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for commercial and research projects without licensing concerns. Quickstart: pip install codecarbon from codecarbon import EmissionsTracker tracker = EmissionsTracker() tracker.start() # Your code here emissions = tracker.stop() print(f"Emissions: {emissions} kg CO₂") Requires Python 3.10 or later. GPU tracking requires nvidia-ml-py and NVIDIA hardware; CPU-only tracking works on any system. Verify before relying: - Accuracy of carbon intensity data by region and how frequently it is updated - Overhead and performance impact of continuous hardware monitoring on long-running processes - Whether disk I/O, network, and cooling are modeled or remain unmeasured ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 204.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags carbon emissions tracking, CO2 measurement local computing, hardware energy consumption monitor, environmental impact of code, GPU CPU RAM emissions, carbon footprint estimation, green computing metrics, sustainability, environmental-impact, hardware-monitoring [View on SkillFed](https://skillfed.io/packages/codecarbon) · [View on PyPI](https://pypi.org/project/codecarbon/)