Visitar URL original
Add support for Python 3.14 · Issue #2610 · pythonnet/pythonnet · GitHub
Skip to content

Add support for Python 3.14 #2610

Description

@freakboy3742

Python.net's requires-python places a hard upper pin on <3.14.

Python 3.14 is nearing release; RC1 is out, which indicates that ABI stability now exists.

It would be desirable for Python.net to support the upcoming Python release.

Activity

  1. EliaOndacs commented on Oct 7, 2025

    @EliaOndacs

    hey, hello, as of right now i'm writing this python 3.14 released, and i unexpectedly ran into this problem of pythonnet not supporting python 3.14, so i'm running into this problem too, (runtime error while trying to run a python script that is using pythonnet), i wonder how long it takes to update it for python 3.14 considering its release-candidates and pre-releases have been out for a while

  2. filmor commented on Oct 7, 2025

    @filmor
    Member

    Any help is appreciated. There is a branch you can test (#2611), but our CI is currently thoroughly broken and I haven't found the time to fix it, yet.

  3. freakboy3742 commented on Oct 7, 2025

    @freakboy3742
    Author

    @filmor I'm unfortunately not in a position to help directly - but if this is a situation that can be fixed by throwing money at someone who does have the skills to investigate the problem, I might be able to help. If that's the case, let me know.

  4. NasirNS45 commented on Oct 29, 2025

    @NasirNS45

    Any update on this? Ran into the same issue while installing awsebcli

  5. filmor commented on Oct 30, 2025

    @filmor
    Member

    Work is happening in #2611. It works in general, but there are at least two crashes that I (or someone who wants to dive in) have to investigate.

  6. andre-romano commented on Nov 17, 2025

    @andre-romano
  7. filmor commented on Nov 17, 2025

    @filmor
  8. marked Add support for Python 3.14.2 #2677 as a duplicate of this issue on Jan 7, 2026
  9. Houbein commented on Feb 23, 2026

    @Houbein
  10. self-assigned this
    on Feb 25, 2026
  11. added this to the 3.1.0 milestone on Feb 25, 2026
  12. added theissue type on Feb 25, 2026
  13. pinned this issue on Feb 25, 2026
  14. filmor commented on Feb 25, 2026

    @filmor
    Member

    3.1.0rc0 is out now with the Python 3.14 support merged. Please test and report back. I still have not found time to fix the CI completely, which is a prerequisite for me to cut this as a full release.

  15. 15 remaining items

  16. MischaPanch commented on Apr 7, 2026

    @MischaPanch

    I guess I will have to be patient and somehow circumvent the missing release for now, thanks for the answer

  17. alexchandel commented on Apr 7, 2026

    @alexchandel

    @MischaPanch You can take a crack at fixing the two failing tests, if you have time.

    The failing unit test blocking 3.14 is test_getting_overloaded_method_binding_does_not_leak_memory, here .

        def test_getting_overloaded_method_binding_does_not_leak_memory():
            """Test that managed object is freed after calling overloaded method. Issue #691"""
        
            from PlainOldNamespace import PlainOldClass
        
            import psutil, os, gc, clr
        
            process = psutil.Process(os.getpid())
            processBytesBeforeCall = process.memory_info().rss
            print("\n\nMemory consumption (bytes) at start of test: " + str(processBytesBeforeCall))
        
            iterations = 500
            for i in range(iterations):
                PlainOldClass().OverloadedMethod.Overloads[int]
        
            gc.collect()
            System.GC.Collect()
        
            processBytesAfterCall = process.memory_info().rss
            print("Memory consumption (bytes) at end of test: " + str(processBytesAfterCall))
            processBytesDelta = processBytesAfterCall - processBytesBeforeCall
            print("Memory delta: " + str(processBytesDelta))
        
            bytesAllocatedPerIteration = pow(2, 20)  # 1MB
            bytesLeakedPerIteration = processBytesDelta / iterations
        
            # Allow 50% threshold - this shows the original issue is fixed, which leaks the full allocated bytes per iteration
            failThresholdBytesLeakedPerIteration = bytesAllocatedPerIteration / 2
        
    >       assert bytesLeakedPerIteration < failThresholdBytesLeakedPerIteration
    E       assert 903208.96 < 524288.0
    
    tests\test_method.py:1015: AssertionError
    ---------------------------- Captured stdout call -----------------------------
    
    
    Memory consumption (bytes) at start of test: 163160064
    Memory consumption (bytes) at end of test: 614764544
    Memory delta: 451604480
    =========================== short test summary info ===========================
    FAILED tests/test_method.py::test_getting_overloaded_method_binding_does_not_leak_memory - assert 903208.96 < 524288.0
    ============= 1 failed, 465 passed, 5 skipped, 1 xpassed in 5.02s =============

    Additionally, the mono tests fail with an internal error here,

      Determining projects to restore...
      All projects are up-to-date for restore.
      Python.Runtime -> /Users/runner/work/pythonnet/pythonnet/pythonnet/runtime/Python.Runtime.dll
      Python.Test -> /Users/runner/work/pythonnet/pythonnet/src/testing/bin/Debug/netstandard2.0/Python.Test.dll
      Python.Test -> /var/folders/t5/f77_gwnj6p95qxy9py3fckx00000gn/T/tmpe58flof0/
    INTERNALERROR> Traceback (most recent call last):
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/pythonnet/__init__.py", line 75, in _create_runtime_from_spec
    INTERNALERROR>     return clr_loader.get_mono(**params)
    INTERNALERROR>            ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/clr_loader/__init__.py", line 78, in get_mono
    INTERNALERROR>     impl = Mono(
    INTERNALERROR>         # domain=domain,
    INTERNALERROR>     ...<7 lines>...
    INTERNALERROR>         set_signal_chaining=set_signal_chaining,
    INTERNALERROR>     )
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/clr_loader/mono.py", line 36, in __init__
    INTERNALERROR>     self._version: str = initialize(
    INTERNALERROR>                          ~~~~~~~~~~^
    INTERNALERROR>         config_file=optional_path_as_string(config_file),
    INTERNALERROR>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    INTERNALERROR>     ...<8 lines>...
    INTERNALERROR>         trace_level=trace_level,
    INTERNALERROR>         ^^^^^^^^^^^^^^^^^^^^^^^^
    INTERNALERROR>     )
    INTERNALERROR>     ^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/clr_loader/mono.py", line 146, in initialize
    INTERNALERROR>     _MONO = load_mono(libmono)
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/clr_loader/ffi/__init__.py", line 49, in load_mono
    INTERNALERROR>     return ffi.dlopen(path_str, ffi.RTLD_GLOBAL)
    INTERNALERROR>            ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/cffi/api.py", line 150, in dlopen
    INTERNALERROR>     lib, function_cache = _make_ffi_library(self, name, flags)
    INTERNALERROR>                           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/cffi/api.py", line 834, in _make_ffi_library
    INTERNALERROR>     backendlib = _load_backend_lib(backend, libname, flags)
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/cffi/api.py", line 829, in _load_backend_lib
    INTERNALERROR>     raise OSError(msg)
    INTERNALERROR> OSError: cannot load library '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib': dlopen(/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib, 0x000A): tried: '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib' (no such file), '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib' (no such file).  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib'
    INTERNALERROR> 
    INTERNALERROR> The above exception was the direct cause of the following exception:
    INTERNALERROR> 
    INTERNALERROR> Traceback (most recent call last):
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/_pytest/main.py", line 314, in wrap_session
    INTERNALERROR>     config._do_configure()
    INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/_pytest/config/__init__.py", line 1159, in _do_configure
    INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
    INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/pluggy/_hooks.py", line 534, in call_historic
    INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls.copy(), kwargs, False)
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/pluggy/_manager.py", line 120, in _hookexec
    INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    INTERNALERROR>            ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 167, in _multicall
    INTERNALERROR>     raise exception
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/.venv/lib/python3.14/site-packages/pluggy/_callers.py", line 121, in _multicall
    INTERNALERROR>     res = hook_impl.function(*args)
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/tests/conftest.py", line 87, in pytest_configure
    INTERNALERROR>     import clr
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/clr.py", line 6, in <module>
    INTERNALERROR>     load()
    INTERNALERROR>     ~~~~^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/pythonnet/__init__.py", line 133, in load
    INTERNALERROR>     set_runtime_from_env()
    INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~^^
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/pythonnet/__init__.py", line 114, in set_runtime_from_env
    INTERNALERROR>     runtime = _create_runtime_from_spec(spec)
    INTERNALERROR>   File "/Users/runner/work/pythonnet/pythonnet/pythonnet/__init__.py", line 90, in _create_runtime_from_spec
    INTERNALERROR>     raise RuntimeError(
    INTERNALERROR>     ...<2 lines>...
    INTERNALERROR>     ) from exc
    INTERNALERROR> RuntimeError: Failed to create a .NET runtime (mono) using the
    INTERNALERROR>                 parameters {}.
  18. rayhaze commented on Apr 7, 2026

    @rayhaze
  19. pinned and unpinned a comment on Apr 8, 2026
  20. filmor commented on Apr 8, 2026

    @filmor
    Member

    The blocker is #2696 and me travelling. I will get back to this in a week or so. If someone contributes patches for the blocker and the remaining CI issues, that would of course help a lot :)

  21. alexchandel commented on Apr 27, 2026

    @alexchandel

    @filmor Do you think that CI failure (test_getting_overloaded_method_binding_does_not_leak_memory) is a genuine memory leak?

  22. dorfman2 commented on May 6, 2026

    @dorfman2
  23. filmor commented on May 16, 2026

    @filmor
    Member

    https://github.com/pythonnet/pythonnet/releases/tag/v3.1.0-rc1 is hopefully the final release candidate. Please test it thoroughly. I will ensure that the changelog is up to date and release it as 3.1.0 next weekend, provided no blockers appear in the meantime.

  24. ghaarsma commented on May 20, 2026

    @ghaarsma

    Looking forward to the official release. We tested our application with V3.1.0-rc1 and found no issues.

    Thanks @filmor , for all your work in getting a Python 3.14 release out the door.

  25. wrichardsonafmil commented on May 21, 2026

    @wrichardsonafmil
  26. freakboy3742 commented on May 22, 2026

    @freakboy3742
    Author

    @filmor I've done another pass of testing with 3.1.0rc1 with Toga's test suite, and didn't spot any problems.

  27. unpinned this issue on May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions