Skip to content

Support Python 3.14#948

Merged
benoit-cty merged 5 commits into
masterfrom
feat/python-3.14
Oct 8, 2025
Merged

Support Python 3.14#948
benoit-cty merged 5 commits into
masterfrom
feat/python-3.14

Conversation

@benoit-cty

@benoit-cty benoit-cty commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

Motivation and Context

Python 3.14 has been released today. We have to check if we support it out-of-the-box.

How Has This Been Tested?

Run uv run --python 3.14 codecarbon monitor without errors.

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@inimaz

inimaz commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

Nice @benoit-cty thanks for this!
Running uv run --python 3.14 codecarbon monitor I get the following pandas/numpy error:

  File "/home/inigo/personal/codecarbon/.venv/bin/codecarbon", line 4, in <module>
    from codecarbon.cli.main import main
  File "/home/inigo/personal/codecarbon/codecarbon/__init__.py", line 6, in <module>
    from .emissions_tracker import (
    ...<3 lines>...
    )
  File "/home/inigo/personal/codecarbon/codecarbon/emissions_tracker.py", line 18, in <module>
    from codecarbon.core.emissions import Emissions
  File "/home/inigo/personal/codecarbon/codecarbon/core/emissions.py", line 11, in <module>
    import pandas as pd
  File "/home/inigo/personal/codecarbon/.venv/lib/python3.14/site-packages/pandas/__init__.py", line 19, in <module>
    raise ImportError(
        "Unable to import required dependencies:\n" + "\n".join(_missing_dependencies)
    )
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

@SaboniAmine SaboniAmine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread .github/workflows/test-package.yml Outdated
@benoit-cty

benoit-cty commented Oct 8, 2025

Copy link
Copy Markdown
Contributor Author

Nice @benoit-cty thanks for this! Running uv run --python 3.14 codecarbon monitor I get the following pandas/numpy error:

  File "/home/inigo/personal/codecarbon/.venv/bin/codecarbon", line 4, in <module>
    from codecarbon.cli.main import main
  File "/home/inigo/personal/codecarbon/codecarbon/__init__.py", line 6, in <module>
    from .emissions_tracker import (
    ...<3 lines>...
    )
  File "/home/inigo/personal/codecarbon/codecarbon/emissions_tracker.py", line 18, in <module>
    from codecarbon.core.emissions import Emissions
  File "/home/inigo/personal/codecarbon/codecarbon/core/emissions.py", line 11, in <module>
    import pandas as pd
  File "/home/inigo/personal/codecarbon/.venv/lib/python3.14/site-packages/pandas/__init__.py", line 19, in <module>
    raise ImportError(
        "Unable to import required dependencies:\n" + "\n".join(_missing_dependencies)
    )
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

Did you run uv sync --python 3.14 before ?

Maybe it's due to https://github.com/pandas-dev/pandas/releases/tag/v2.3.3

EDIT:
I've added:

    "pandas>=2.3.3;python_version>='3.14'",
    "pandas;python_version<'3.14'",

@benoit-cty benoit-cty merged commit bcf998c into master Oct 8, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants