Bug 2327976 - python-sqlalchemy1.4 fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'.
Summary: python-sqlalchemy1.4 fails to build with Python 3.14: RuntimeError: There is ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-sqlalchemy1.4
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nils Philippsen
QA Contact:
URL:
Whiteboard:
: 2372149 (view as bug list)
Depends On:
Blocks: PYTHON3.14 F43FTBFS, RAWHIDEFTBFS F43FailsToInstall, RAWHIDEFailsToInstall 2372159
TreeView+ depends on / blocked
 
Reported: 2024-11-22 10:02 UTC by Karolina Surma
Modified: 2025-06-12 08:01 UTC (History)
5 users (show)

Fixed In Version: python-sqlalchemy1.4-1.4.54-4.fc43
Clone Of:
Environment:
Last Closed: 2025-06-12 08:01:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sqlalchemy sqlalchemy pull 12666 0 None open Rel 1 4 py314 2025-06-11 21:36:20 UTC

Description Karolina Surma 2024-11-22 10:02:25 UTC
python-sqlalchemy1.4 fails to build with Python 3.14.0a2.

+ /usr/bin/pytest test -k 'not aaa_profiling'
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/builddir/build/BUILD/python-sqlalchemy1.4-1.4.54-build/sqlalchemy-1.4.54/lib/sqlalchemy/util/_concurrency_py3k.py", line 191, in get_event_loop
INTERNALERROR>     return asyncio.get_running_loop()
INTERNALERROR>            ~~~~~~~~~~~~~~~~~~~~~~~~^^
INTERNALERROR> RuntimeError: no running event loop
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 281, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/lib/python3.14/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/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 "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/builddir/build/BUILD/python-sqlalchemy1.4-1.4.54-build/sqlalchemy-1.4.54/test/../lib/sqlalchemy/testing/plugin/pytestplugin.py", line 129, in pytest_sessionstart
INTERNALERROR>     asyncio._assume_async(plugin_base.post_begin)
INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/builddir/build/BUILD/python-sqlalchemy1.4-1.4.54-build/sqlalchemy-1.4.54/lib/sqlalchemy/testing/asyncio.py", line 50, in _assume_async
INTERNALERROR>     return _util_async_run(fn, *args, **kwargs)
INTERNALERROR>   File "/builddir/build/BUILD/python-sqlalchemy1.4-1.4.54-build/sqlalchemy-1.4.54/lib/sqlalchemy/util/_concurrency_py3k.py", line 172, in _util_async_run
INTERNALERROR>     loop = get_event_loop()
INTERNALERROR>   File "/builddir/build/BUILD/python-sqlalchemy1.4-1.4.54-build/sqlalchemy-1.4.54/lib/sqlalchemy/util/_concurrency_py3k.py", line 193, in get_event_loop
INTERNALERROR>     return asyncio.get_event_loop_policy().get_event_loop()
INTERNALERROR>            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
INTERNALERROR>   File "/usr/lib64/python3.14/asyncio/events.py", line 681, in get_event_loop
INTERNALERROR>     raise RuntimeError('There is no current event loop in thread %r.'
INTERNALERROR>                        % threading.current_thread().name)
INTERNALERROR> RuntimeError: There is no current event loop in thread 'MainThread'.

According to https://docs.python.org/dev/whatsnew/3.14.html#id3

Removed implicit creation of event loop by asyncio.get_event_loop(). It now raises a RuntimeError if there is no current event loop. (Contributed by Kumar Aditya in gh-126353.)


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08292895-python-sqlalchemy1.4/

For all our attempts to build python-sqlalchemy1.4 with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-sqlalchemy1.4/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Aoife Moloney 2025-02-26 13:17:28 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 2 Nils Philippsen 2025-02-26 13:26:43 UTC
This will be relevant for Fedora 43, so changing the version back. 😉

Comment 3 Karolina Surma 2025-06-11 16:04:48 UTC
*** Bug 2372149 has been marked as a duplicate of this bug. ***

Comment 4 Nils Philippsen 2025-06-11 16:41:28 UTC
/cc @mbayer

Hey Mike, I realize that 1.4 is probably not at the top of your head. Nonetheless, to solve #2350336 (same thing, just for v2.0) you fixed a couple of separate issues but I don’t know which of these apply here (IIRC, some were because of 3.14 being more of a moving target) – I’ve attempted back-porting changes 2.0 => 1.4 before but wasn’t successful, but I want to help if I can. Got any pointers?

Comment 5 Michael Bayer 2025-06-11 16:58:41 UTC
for that issue you'd be looking to backport this commit:

https://github.com/sqlalchemy/sqlalchemy/commit/4bc12e6abda97386b2eb66aff21312d010e

the patch does not apply without conflicts right now because the 1.4 series has all the py2k/py3k conditionals going on.

another approach would be to run the test suite passing ``--disable-asyncio``.   that will just skip all the asyncio tests.   you would not be able to test against an asyncio database driver when that flag is passed.   IIUC you are just running the default suite against sqlite only.

if you are trying to get 1.4 to pass under python 3.14 you also might come across the test_memusage change that was part of the 2.0 patch.

Most of the other stuff in 2.0's patch is related to the runtime annotation stuff, of which none of that is in 1.4.

Comment 6 Nils Philippsen 2025-06-11 21:36:21 UTC
I’ve submitted a PR against rel_1_4 here: https://github.com/sqlalchemy/sqlalchemy/pull/12666

Comment 7 Nils Philippsen 2025-06-11 21:48:11 UTC
Building python-sqlalchemy1.4-1.4.54-4.fc43: https://koji.fedoraproject.org/koji/taskinfo?taskID=133842011


Note You need to log in before you can comment on or make changes to this bug.