codecarbon
Track emissions from Compute and recommend ways to reduce their impact on the environment.
Science Score: 59.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
4 of 95 committers (4.2%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.4%) to scientific vocabulary
Keywords from Contributors
Repository
Track emissions from Compute and recommend ways to reduce their impact on the environment.
Basic Info
- Host: GitHub
- Owner: mlco2
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://mlco2.github.io/codecarbon
- Size: 28 MB
Statistics
- Stars: 1,541
- Watchers: 20
- Forks: 221
- Open Issues: 123
- Releases: 52
Metadata Files
README.md

Estimate and track carbon emissions from your computer, quantify and analyze their impact.
About CodeCarbon 💡
CodeCarbon started with a quite simple question:
What is the carbon emission impact of my computer program? :shrug:
We found some global data like "computing currently represents roughly 0.5% of the world’s energy consumption" but nothing on our individual/organisation level impact.
At CodeCarbon, we believe, along with Niels Bohr, that "Nothing exists until it is measured". So we found a way to estimate how much CO2 we produce while running our code.
How?
We created a Python package that estimates your hardware electricity power consumption (GPU + CPU + RAM) and we apply to it the carbon intensity of the region where the computing is done.

We explain more about this calculation in the Methodology section of the documentation.
Our hope is that this package will be used widely for estimating the carbon footprint of computing, and for establishing best practices with regards to the disclosure and reduction of this footprint.
So ready to "change the world one run at a time"? Let's start with a very quick set up.
Quickstart 🚀
Installation 🔧
From PyPI repository
python
pip install codecarbon
From Conda repository
python
conda install -c codecarbon codecarbon
To see more installation options please refer to the documentation: Installation
Start to estimate your impact 📏
Without using the online dashboard
python
from codecarbon import track_emissions
@track_emissions()
def your_function_to_track():
# your code
After running your code, you will find an emissions.csv that you can visualize with carbonboard --filepath="examples/emissions.csv".
With the online dashboard
To use the online dashboard you need to create an account on CodeCarbon Dashboard. Once you have an account, you can create an experiment_id to track your emissions.
To get an experimentid enter:
python
! codecarbon login
You can now store it in a .codecarbon.config at the root of your project
```python
[codecarbon]
loglevel = DEBUG
savetoapi = True
experimentid = 2bcbcbb8-850d-4692-af0d-76f6f36d79b2 #the experimentid you get with init
```
Now you have 2 main options:
Monitoring your machine 💻
In your command prompt use:
codecarbon monitor
The package will track your emissions independently from your code.
In your Python code 🐍
python
from codecarbon import track_emissions
@track_emissions()
def your_function_to_track():
# your code
The package will track the emissions generated by the execution of your function.
There is other ways to use codecarbon package, please refer to the documentation to learn more about it: Usage
Visualize 📊
You can now visualize your experiment emissions on the dashboard.

Hope you enjoy your first steps monitoring your carbon computing impact! Thanks to the incredible codecarbon community 💪🏼 a lot more options are available using codecarbon including: - offline mode - cloud mode - comet integration...
Please explore the Documentation to learn about it If ever what your are looking for is not yet implemented, let us know through the issues and even better become one of our 🦸🏼♀️🦸🏼♂️ contributors! more info 👇🏼
Contributing 🤝
We are hoping that the open-source community will help us edit the code and make it better!
You are welcome to open issues, even suggest solutions and better still contribute the fix/improvement! We can guide you if you're not sure where to start but want to help us out 🥇
In order to contribute a change to our code base, please submit a pull request (PR) via GitHub and someone from our team will go over it and accept it.
Check out our contribution guidelines :arrowupperright:
Contact @vict0rsch to be added to our slack workspace if you want to contribute regularly!
How To Cite 📝
If you find CodeCarbon useful for your research, you can find a citation under a variety of formats on Zenodo.
Here is a sample for BibTeX:
tex
@software{benoit_courty_2024_11171501,
author = {Benoit Courty and
Victor Schmidt and
Sasha Luccioni and
Goyal-Kamal and
MarionCoutarel and
Boris Feld and
Jérémy Lecourt and
LiamConnell and
Amine Saboni and
Inimaz and
supatomic and
Mathilde Léval and
Luis Blanche and
Alexis Cruveiller and
ouminasara and
Franklin Zhao and
Aditya Joshi and
Alexis Bogroff and
Hugues de Lavoreille and
Niko Laskaris and
Edoardo Abati and
Douglas Blank and
Ziyao Wang and
Armin Catovic and
Marc Alencon and
Michał Stęchły and
Christian Bauer and
Lucas Otávio N. de Araújo and
JPW and
MinervaBooks},
title = {mlco2/codecarbon: v2.4.1},
month = may,
year = 2024,
publisher = {Zenodo},
version = {v2.4.1},
doi = {10.5281/zenodo.11171501},
url = {https://doi.org/10.5281/zenodo.11171501}
}
Contact 📝
Maintainers are @vict0rsch @benoit-cty and @SaboniAmine. Codecarbon is developed by volunteers from Mila and the DataForGoodFR community alongside donated professional time of engineers at Comet.ml and BCG GAMMA.
Star History
Comparison of the number of stars accumulated by the different Python CO2 emissions projects:
Owner
- Name: CodeCarbon
- Login: mlco2
- Kind: organization
- Website: https://codecarbon.io
- Repositories: 7
- Profile: https://github.com/mlco2
GitHub Events
Total
- Create event: 115
- Release event: 17
- Issues event: 92
- Watch event: 331
- Delete event: 80
- Member event: 1
- Issue comment event: 270
- Push event: 458
- Pull request event: 231
- Pull request review event: 226
- Pull request review comment event: 79
- Fork event: 44
Last Year
- Create event: 115
- Release event: 17
- Issues event: 92
- Watch event: 331
- Delete event: 80
- Member event: 1
- Issue comment event: 270
- Push event: 458
- Pull request event: 231
- Pull request review event: 226
- Pull request review comment event: 79
- Fork event: 44
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| benoit-cty | 6****y | 298 |
| benoit-cty | 4****y@u****v | 266 |
| vict0rsch | v****h@p****e | 193 |
| Kamal Goyal | g****l@b****m | 182 |
| MarionCoutarel | m****z@g****m | 108 |
| inimaz | 4****z | 88 |
| LuisBlanche | l****r@g****m | 83 |
| jl-datascientist | j****e@g****m | 51 |
| Boris Feld | l****n@g****m | 48 |
| Liam Connell | c****m@b****m | 39 |
| Amine Saboni | a****i@o****m | 37 |
| Amine Saboni | 4****e | 34 |
| patrick.lloret@protonmail.com | p****t@p****m | 33 |
| benoit-cty | b****y@e****m | 30 |
| benoit-cty | b****y@l****v | 29 |
| dependabot[bot] | 4****] | 26 |
| Alexis Cruveiller | a****r@g****m | 24 |
| Mathilde Léval | m****l@g****m | 22 |
| OUMINA-SARA | o****a@b****m | 22 |
| Zhao Franklin | q****o@b****u | 22 |
| Mathilde Leval | m****l@c****m | 18 |
| MyGodItsFull0fStars | c****r@e****t | 18 |
| Jerry Laruba Festus | j****s@g****m | 17 |
| Sasha Luccioni | l****s@m****c | 17 |
| Aditya Joshi | 1****i@g****m | 17 |
| Kamal Nayan Goyal | k****l | 16 |
| AlexisBogroff | a****f@g****m | 14 |
| Hugues Souchard de Lavoreille | h****l@g****m | 14 |
| Nikolas Laskaris | l****k@g****m | 13 |
| Alexandre Phiev | a****v@g****m | 13 |
| and 65 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 375
- Total pull requests: 742
- Average time to close issues: 6 months
- Average time to close pull requests: 23 days
- Total issue authors: 181
- Total pull request authors: 91
- Average comments per issue: 2.49
- Average comments per pull request: 0.88
- Merged pull requests: 599
- Bot issues: 0
- Bot pull requests: 56
Past Year
- Issues: 90
- Pull requests: 292
- Average time to close issues: 20 days
- Average time to close pull requests: 10 days
- Issue authors: 56
- Pull request authors: 27
- Average comments per issue: 1.21
- Average comments per pull request: 0.5
- Merged pull requests: 215
- Bot issues: 0
- Bot pull requests: 31
Top Authors
Issue Authors
- benoit-cty (55)
- vict0rsch (26)
- inimaz (16)
- LiamConnell (13)
- SaboniAmine (8)
- mkbane (8)
- dsblank (8)
- stas00 (7)
- kngoyal (6)
- RafiullahOmar (6)
- headscott (6)
- pugantsov (4)
- qxpBlog (4)
- Lothiraldan (4)
- Lucas-Otavio (3)
Pull Request Authors
- benoit-cty (140)
- inimaz (123)
- prmths128 (66)
- SaboniAmine (60)
- dependabot[bot] (56)
- vict0rsch (30)
- Lothiraldan (20)
- MyGodItsFull0fStars (19)
- kngoyal (18)
- LiamConnell (12)
- LuisBlanche (11)
- IamLRBA (10)
- mathilde-leval (8)
- alexphiev (7)
- MarionCoutarel (7)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 6
-
Total downloads:
- pypi 48,433 last-month
- Total docker downloads: 430,060
-
Total dependent packages: 39
(may contain duplicates) -
Total dependent repositories: 807
(may contain duplicates) - Total versions: 130
- Total maintainers: 1
pypi.org: codecarbon
- Homepage: https://codecarbon.io/
- Documentation: https://mlco2.github.io/codecarbon/
- License: mit
-
Latest release: 3.0.4
published 7 months ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/mlco2/codecarbon
- Documentation: https://pkg.go.dev/github.com/mlco2/codecarbon#section-documentation
- License: mit
-
Latest release: v3.0.4+incompatible
published 7 months ago
Rankings
conda-forge.org: codecarbon
Emissions Tracker is a Python package for tracking the carbon emissions produced by various kinds of computer programs, from straightforward algorithms to deep neural networks. By taking into account your computing infrastructure, location, usage and running time, Emissions Tracker can provide an estimate of how much CO2 you produced, and give you some comparisons with common modes of transporation to give you an order of magnitude.
- Homepage: https://pypi.org/project/codecarbon/
- License: MIT
-
Latest release: 2.1.4
published over 3 years ago
Rankings
conda-forge.org: codecarbon-test
Emissions Tracker is a Python package for tracking the carbon emissions produced by various kinds of computer programs, from straightforward algorithms to deep neural networks. By taking into account your computing infrastructure, location, usage and running time, Emissions Tracker can provide an estimate of how much CO2 you produced, and give you some comparisons with common modes of transporation to give you an order of magnitude.
- Homepage: https://pypi.org/project/codecarbon/
- License: MIT
-
Latest release: 2.1.4
published over 3 years ago
Rankings
conda-forge.org: codecarbon-viz
Emissions Tracker is a Python package for tracking the carbon emissions produced by various kinds of computer programs, from straightforward algorithms to deep neural networks. By taking into account your computing infrastructure, location, usage and running time, Emissions Tracker can provide an estimate of how much CO2 you produced, and give you some comparisons with common modes of transporation to give you an order of magnitude.
- Homepage: https://pypi.org/project/codecarbon/
- License: MIT
-
Latest release: 2.1.4
published over 3 years ago
Rankings
conda-forge.org: codecarbon-dev
Emissions Tracker is a Python package for tracking the carbon emissions produced by various kinds of computer programs, from straightforward algorithms to deep neural networks. By taking into account your computing infrastructure, location, usage and running time, Emissions Tracker can provide an estimate of how much CO2 you produced, and give you some comparisons with common modes of transporation to give you an order of magnitude.
- Homepage: https://pypi.org/project/codecarbon/
- License: MIT
-
Latest release: 2.1.4
published over 3 years ago
Rankings
Dependencies
- alembic * development
- fastapi * development
- fastapi-pagination * development
- psycopg2 * development
- pydantic * development
- requests * development
- sqlalchemy * development
- tox * development
- uvicorn * development
- alembic * development
- bcrypt * development
- dependency-injector * development
- fastapi * development
- fastapi-pagination * development
- psycopg2-binary * development
- pydantic * development
- python-dateutil * development
- requests * development
- sqlalchemy * development
- tox * development
- uvicorn * development
- alembic *
- bcrypt *
- dependency-injector *
- fastapi *
- fastapi-pagination *
- psycopg2-binary *
- pydantic *
- python-dateutil *
- requests *
- sqlalchemy *
- tox *
- uvicorn *
- keras-tuner *
- tensorflow *
- torch ==1.8.1
- torchvision *
- arrow * development
- black * development
- dash * development
- dash_bootstrap_components * development
- dataclasses * development
- fire * development
- flake8 * development
- fuzzywuzzy * development
- isort * development
- mypy * development
- pandas * development
- psutil * development
- py-cpuinfo * development
- pynvml * development
- requests * development
- responses * development
- sphinx * development
- sphinx-rtd-theme * development
- fuzzywuzzy * test
- mock * test
- numpy * test
- psutil * test
- pytest * test
- requests-mock * test
- responses * test
- tox * test
- actions/checkout v2 composite
- actions/setup-python v1 composite
- actions/setup-python v2 composite
- postgres 12 docker
- actions/checkout v2 composite
- actions/setup-python v1 composite
- actions/upload-artifact v1 composite
- actions/cache v1 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- pre-commit/action v3.0.0 composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
- release-drafter/release-drafter v5.7.0 composite
- ubuntu 20.04 build
- ubuntu 20.04 build
- python 3.8 build
- dpage/pgadmin4 latest
- postgres 12
- codecarbon >=2.0.0
- dash >=2.2.0
- dash_bootstrap_components *
- plotly >=5.6.0
- codecarbon >=2.0.0
- dash >=2.2.0
- gunicorn *
- plotly >=5.6.0
- codecarbon >=2.0.0
- dash >=2.2.0
- dash_bootstrap_components *
- plotly >=5.6.0