-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Description
Dear maintainers;
I did a fresh install of codecarbon from pip. I wrote the following foo.py snippet:
from codecarbon import EmissionsTracker
def fibonacci(n = 10, a = 0, b = 1):
fibonacci_numbers = []
for _ in range(n):
fibonacci_numbers.append(a)
a, b = b, a + b
print(" ".join((str(x) for x in fibonacci_numbers)))
def main():
tracker = EmissionsTracker(save_to_api=True)
tracker.start()
try:
fibonacci(100)
finally:
tracker.stop()
main()Then, I ran:
python3 foo.pyI got this emissions.csv file:
timestamp,project_name,run_id,experiment_id,duration,emissions,emissions_rate,cpu_power,gpu_power,ram_power,cpu_energy,gpu_energy,ram_energy,energy_consumed,water_consumed,country_name,country_iso_code,region,os,python_version,codecarbon_version,cpu_count,cpu_model,longitude,latitude,ram_total_size,tracking_mode,on_cloud,pue,wue,gpu_count,gpu_model,cloud_provider,cloud_region
2025-12-15T22:41:36,codecarbon,7298c4f8-013c-4b51-9a54-432a6f462e14,13cdea21-60f1-4ab7-b747-bb98434fda26,1.007217715000479,9.028958008232413e-08,8.964256559196954e-08,1.5098415000000005,0.0,10.0,2.118613472255542e-07,0.0,1.399330502777553e-06,1.6111918500031071e-06,0.0,France,FRA,île-de-france,Linux-6.17.9+deb14-amd64-x86_64-with-glibc2.41,3.13.9,3.2.0,8,Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz,2.278,48.8232,15.482418060302734,machine,N,1.0,0.0,,,,
2025-12-15T23:09:00,codecarbon,f9959175-8abf-4f36-87cf-7b8096e9d68e,13cdea21-60f1-4ab7-b747-bb98434fda26,0.007951945000002,6.53238782187226e-10,8.214830235710333e-08,1.747587230228331,0.0,10.0,2.1869461940167423e-09,0.0,9.46991388891168e-09,1.1656860082928425e-08,0.0,France,FRA,île-de-france,Linux-6.17.11+deb14-amd64-x86_64-with-glibc2.42,3.13.9,3.2.0,8,Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz,2.278,48.8232,15.482414245605469,machine,N,1.0,0.0,1.0,1 x NVIDIA GeForce MX150,,
2025-12-15T23:15:06,codecarbon,7f7e1e9f-b3fd-470f-82bf-043958f09e3b,13cdea21-60f1-4ab7-b747-bb98434fda26,0.0042417559999989,3.5323739598227236e-10,8.32762176754997e-08,2.0271165520225467,0.0,10.0,1.644723538000428e-09,0.0,4.658697222224993e-09,6.303420760225421e-09,0.0,France,FRA,île-de-france,Linux-6.17.11+deb14-amd64-x86_64-with-glibc2.42,3.13.9,3.2.0,8,Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz,2.278,48.8232,15.482414245605469,machine,N,1.0,0.0,,,,
2025-12-15T23:16:29,codecarbon,2432f91d-b999-4526-a7b2-dc7c82a37117,13cdea21-60f1-4ab7-b747-bb98434fda26,0.0037207430000023,2.770028317977422e-10,7.444825718883747e-08,0.9760548939373808,0.0,10.0,6.952783339976607e-10,0.0,4.2477583332830216e-09,4.943036667280682e-09,0.0,France,FRA,île-de-france,Linux-6.17.11+deb14-amd64-x86_64-with-glibc2.42,3.13.9,3.2.0,8,Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz,2.278,48.8232,15.482414245605469,machine,N,1.0,0.0,,,,
2025-12-16T00:00:28,codecarbon,None,13cdea21-60f1-4ab7-b747-bb98434fda26,0.004521185000157857,3.646006799121205e-10,8.064272528095852e-08,1.2682052761013605,0.0,10.0,1.1019453258947001e-09,0.0,5.404250000790652e-09,6.506195326685352e-09,0.0,France,FRA,île-de-france,Linux-6.17.11+deb14-amd64-x86_64-with-glibc2.42,3.13.9,3.2.0,8,Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz,2.278,48.8232,15.482414245605469,machine,N,1.0,0.0,,,,
When running:
carbonboard --filepath="emissions.csv" --port=3333... I get the following error:
[codecarbon.viz.carbonboard ERROR @ 23:34:34] Exception on /_dash-update-component [POST]
Traceback (most recent call last):
File "/home/mando/.local/lib/python3.13/site-packages/flask/app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
File "/home/mando/.local/lib/python3.13/site-packages/flask/app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/mando/.local/lib/python3.13/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
File "/home/mando/.local/lib/python3.13/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/dash/_get_app.py", line 17, in wrap
return ctx.run(func, self, *args, **kwargs)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/dash/dash.py", line 1585, in dispatch
response_data = ctx.run(partial_func)
File "/home/mando/.local/lib/python3.13/site-packages/dash/_callback.py", line 721, in add_context
raise err
File "/home/mando/.local/lib/python3.13/site-packages/dash/_callback.py", line 712, in add_context
output_value = _invoke_callback(func, *func_args, **func_kwargs) # type: ignore[reportArgumentType]
File "/home/mando/.local/lib/python3.13/site-packages/dash/_callback.py", line 59, in _invoke_callback
return func(*args, **kwargs) # %% callback invoked %%
File "/home/mando/.local/lib/python3.13/site-packages/codecarbon/viz/carbonboard.py", line 218, in update_project_bar_chart
return components.get_project_emissions_bar_chart_figure(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
hidden_project_data["props"]["data"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/mando/.local/lib/python3.13/site-packages/codecarbon/viz/components.py", line 670, in get_project_emissions_bar_chart_figure
px.bar(
~~~~~~^
project_data,
^^^^^^^^^^^^^
...<21 lines>...
},
^^
)
^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/express/_chart_types.py", line 381, in bar
return make_figure(
args=locals(),
...<2 lines>...
layout_patch=dict(barmode=barmode),
)
File "/home/mando/.local/lib/python3.13/site-packages/plotly/express/_core.py", line 2477, in make_figure
apply_default_cascade(args)
~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/express/_core.py", line 1072, in apply_default_cascade
bar.marker.pattern.shape for bar in args["template"].data.bar
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/graph_objs/bar/marker/_pattern.py", line 252, in shape
return self["shape"]
~~~~^^^^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 4734, in __getitem__
elif self._props is not None and prop in self._props:
^^^^^^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 4429, in _props
return self.parent._get_child_props(self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 4443, in _get_child_props
if self._props is None:
^^^^^^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 4429, in _props
return self.parent._get_child_props(self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 4443, in _get_child_props
if self._props is None:
^^^^^^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 4429, in _props
return self.parent._get_child_props(self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 4463, in _get_child_props
child_ind = BaseFigure._index_is(children, child)
File "/home/mando/.local/lib/python3.13/site-packages/plotly/basedatatypes.py", line 3957, in _index_is
raise ValueError("Invalid value")
ValueError: Invalid value
Best regards
Metadata
Metadata
Assignees
Labels
No labels