CodeCarbon
Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://github.com/mlco2/codecarbon
Category: Consumption
Sub Category: Computation and Communication
Keywords from Contributors
language-model transformer archiving climate-change measur tensors autograd generic annotation sustainability
Last synced: about 16 hours ago
JSON representation
Repository metadata
Track emissions from Compute and recommend ways to reduce their impact on the environment.
- Host: GitHub
- URL: https://github.com/mlco2/codecarbon
- Owner: mlco2
- License: mit
- Created: 2020-05-12T14:44:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-04-20T14:51:18.000Z (7 days ago)
- Last Synced: 2025-04-23T21:59:24.838Z (3 days ago)
- Language: Python
- Homepage: https://mlco2.github.io/codecarbon
- Size: 27.6 MB
- Stars: 1,371
- Watchers: 22
- Forks: 204
- Open Issues: 104
- Releases: 48
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
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? 🤷
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
pip install codecarbon
From Conda repository
conda install -c codecarbon codecarbon
To see more installation options please refer to the documentation: Installation
Start to estimate your impact 📏
To get an experiment_id enter:
! codecarbon init
You can now store it in a .codecarbon.config at the root of your project
[codecarbon]
log_level = DEBUG
save_to_api = True
experiment_id = 2bcbcbb8-850d-4692-af0d-76f6f36d79b2 #the experiment_id 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 🐍
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.
Note that for now, all emissions data send to codecarbon API are public.
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 ↗️
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:
@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 metadata
- Name: mlco2
- Login: mlco2
- Email:
- Kind: organization
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/54071934?v=4
- Repositories: 3
- Last ynced at: 2023-03-04T16:29:39.216Z
- Profile URL: https://github.com/mlco2
GitHub Events
Total
- Create event: 85
- Release event: 12
- Issues event: 56
- Watch event: 225
- Delete event: 61
- Issue comment event: 174
- Push event: 358
- Pull request event: 163
- Pull request review event: 165
- Pull request review comment event: 60
- Fork event: 28
Last Year
- Create event: 85
- Release event: 12
- Issues event: 56
- Watch event: 225
- Delete event: 61
- Issue comment event: 174
- Push event: 358
- Pull request event: 163
- Pull request review event: 165
- Pull request review comment event: 60
- Fork event: 28
Committers metadata
Last synced: 7 days ago
Total Commits: 1,820
Total Committers: 87
Avg Commits per committer: 20.92
Development Distribution Score (DDS): 0.841
Commits in past year: 454
Committers in past year: 27
Avg Commits per committer in past year: 16.815
Development Distribution Score (DDS) in past year: 0.641
Name | Commits | |
---|---|---|
benoit-cty | 6****y | 290 |
benoit-cty | 4****y@u****v | 225 |
vict0rsch | v****h@p****e | 193 |
Kamal Goyal | g****l@b****m | 182 |
MarionCoutarel | m****z@g****m | 108 |
LuisBlanche | l****r@g****m | 83 |
inimaz | 4****z | 76 |
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 |
[email protected] | p****t@p****m | 32 |
benoit-cty | b****y@e****m | 30 |
Amine Saboni | 4****e | 28 |
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 |
dependabot[bot] | 4****] | 22 |
Mathilde Leval | m****l@c****m | 18 |
MyGodItsFull0fStars | c****r@e****t | 18 |
Sasha Luccioni | l****s@m****c | 17 |
Aditya Joshi | 1****i@g****m | 17 |
Kamal Nayan Goyal | k****l | 16 |
Hugues Souchard de Lavoreille | h****l@g****m | 14 |
AlexisBogroff | a****f@g****m | 14 |
Alexandre Phiev | a****v@g****m | 13 |
Nikolas Laskaris | l****k@g****m | 13 |
rosekelly6400 | r****0@g****m | 9 |
Edoardo Abati | 2****i | 9 |
and 57 more... |
Committer domains:
- bcg.com: 4
- equancy.com: 2
- users.noreply.git.leximpact.dev: 1
- pm.me: 1
- octo.com: 1
- berkeley.edu: 1
- csod.com: 1
- edu.aau.at: 1
- mila.quebec: 1
- leximpact.dev: 1
- hotmail.se: 1
- haverford.edu: 1
- buster.ai: 1
- vianello.ai: 1
- slalom.com: 1
- sanger.ac.uk: 1
- dotarmin.info: 1
- online.no: 1
- alexandra.dk: 1
- mail.polimi.it: 1
- orange.fr: 1
- amsterdam.nl: 1
- there.co.nz: 1
- maxbachmann.de: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 349
Total pull requests: 506
Average time to close issues: 6 months
Average time to close pull requests: 23 days
Total issue authors: 166
Total pull request authors: 83
Average comments per issue: 3.09
Average comments per pull request: 1.05
Merged pull request: 428
Bot issues: 0
Bot pull requests: 34
Past year issues: 88
Past year pull requests: 231
Past year average time to close issues: 27 days
Past year average time to close pull requests: 12 days
Past year issue authors: 57
Past year pull request authors: 28
Past year average comments per issue: 3.09
Past year average comments per pull request: 0.69
Past year merged pull request: 183
Past year bot issues: 0
Past year bot pull requests: 34
Top Issue Authors
- benoit-cty (42)
- vict0rsch (26)
- inimaz (14)
- LiamConnell (13)
- SaboniAmine (9)
- dsblank (8)
- mkbane (8)
- stas00 (7)
- kngoyal (6)
- RafiullahOmar (6)
- headscott (6)
- qxpBlog (4)
- pugantsov (4)
- Lothiraldan (4)
- TECO-Octo (3)
Top Pull Request Authors
- benoit-cty (97)
- inimaz (68)
- prmths128 (36)
- SaboniAmine (34)
- dependabot[bot] (34)
- vict0rsch (30)
- Lothiraldan (20)
- kngoyal (19)
- LiamConnell (12)
- MyGodItsFull0fStars (12)
- mathilde-leval (8)
- LuisBlanche (8)
- dsblank (6)
- MarionCoutarel (6)
- adijo (5)
Top Issue Labels
- enhancement (82)
- good first issue (52)
- bug (46)
- documentation (35)
- question (32)
- dataforgood (20)
- API (17)
- help wanted (15)
- P1 (10)
- P2 (7)
- P3 (7)
- wontfix (7)
- docs (4)
- Dashboard (4)
- duplicate (2)
- invalid (1)
- Expand contributors (1)
Top Pull Request Labels
- dependencies (34)
- API (13)
- javascript (10)
- python (8)
- enhancement (8)
- bug (3)
- docs (2)
- dataforgood (2)
- Dashboard (2)
- good first issue (1)
- documentation (1)
- invalid (1)
Package metadata
- Total packages: 5
-
Total downloads:
- pypi: 59,633 last-month
- Total docker downloads: 430,060
- Total dependent packages: 39 (may contain duplicates)
- Total dependent repositories: 807 (may contain duplicates)
- Total versions: 78
- Total maintainers: 3
pypi.org: codecarbon
- Homepage: https://codecarbon.io/
- Documentation: https://mlco2.github.io/codecarbon/
- Licenses: MIT License
- Latest release: 3.0.0 (published 9 days ago)
- Last Synced: 2025-04-18T07:31:27.775Z (9 days ago)
- Versions: 53
- Dependent Packages: 36
- Dependent Repositories: 806
- Downloads: 59,633 Last month
- Docker Downloads: 430,060
-
Rankings:
- Dependent packages count: 0.372%
- Dependent repos count: 0.423%
- Average: 0.73%
- Docker downloads count: 0.955%
- Downloads: 1.169%
- Maintainers (3)
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/
- Licenses: MIT
- Latest release: 2.1.4 (published over 2 years ago)
- Last Synced: 2025-04-25T14:08:02.158Z (1 day ago)
- Versions: 7
- Dependent Packages: 2
- Dependent Repositories: 1
-
Rankings:
- Stargazers count: 15.742%
- Forks count: 18.727%
- Average: 19.538%
- Dependent packages count: 19.581%
- Dependent repos count: 24.103%
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/
- Licenses: MIT
- Latest release: 2.1.4 (published over 2 years ago)
- Last Synced: 2025-04-25T14:08:00.299Z (1 day ago)
- Versions: 6
- Dependent Packages: 1
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 15.583%
- Forks count: 19.206%
- Average: 24.409%
- Dependent packages count: 28.82%
- Dependent repos count: 34.025%
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/
- Licenses: MIT
- Latest release: 2.1.4 (published over 2 years ago)
- Last Synced: 2025-04-25T14:08:01.941Z (1 day ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 15.583%
- Forks count: 19.206%
- Average: 29.998%
- Dependent repos count: 34.025%
- Dependent packages count: 51.175%
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/
- Licenses: MIT
- Latest release: 2.1.4 (published over 2 years ago)
- Last Synced: 2025-04-02T02:57:09.631Z (25 days ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 15.583%
- Forks count: 19.206%
- Average: 29.998%
- Dependent repos count: 34.025%
- Dependent packages count: 51.175%
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
Score: 24.86582197575033