Bug 2328708 - pychess fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'.
Summary: pychess fails to build with Python 3.14: RuntimeError: There is no current ev...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: pychess
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Bruno Wolff III
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2371777 (view as bug list)
Depends On:
Blocks: PYTHON3.14 F43FTBFS, RAWHIDEFTBFS F43FailsToInstall, RAWHIDEFailsToInstall
TreeView+ depends on / blocked
 
Reported: 2024-11-25 16:31 UTC by Karolina Surma
Modified: 2025-06-13 15:08 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-11-25 16:31:24 UTC
pychess fails to build with Python 3.14.0a2.

======================================================================
ERROR: test1 (analysis.CECPTests.test1)
Test analyzing in forced mate situations
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pychess-1.0.3-build/pychess-1.0.3/testing/analysis.py", line 79, in setUp
    self.loop = asyncio.get_event_loop()
                ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.14/asyncio/events.py", line 681, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
                       % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.

======================================================================
ERROR: test2 (analysis.CECPTests.test2)
Test analyzing in promotion situations
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pychess-1.0.3-build/pychess-1.0.3/testing/analysis.py", line 79, in setUp
    self.loop = asyncio.get_event_loop()
                ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.14/asyncio/events.py", line 681, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
                       % threading.current_thread().name)
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.)


https://docs.python.org/3.14/whatsnew/3.14.html

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

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

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:18:09 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 2 Karolina Surma 2025-06-11 15:55:10 UTC
*** Bug 2371777 has been marked as a duplicate of this bug. ***

Comment 3 Miro Hrončok 2025-06-11 22:40:10 UTC
This currently fails with:

+ /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -sP'
Warning: eco.db not found, please run pgn2ecodb.sh
Traceback (most recent call last):
  File "/builddir/build/BUILD/pychess-1.0.3-build/pychess-1.0.3/setup.py", line 56, in <module>
    from distutils.command.register import register
ModuleNotFoundError: No module named 'distutils.command.register'

Comment 4 Raphael Groner 2025-06-12 07:12:29 UTC
> Warning: eco.db not found, please run pgn2ecodb.sh

What happens with legacy db? What if there is no db? Guess it is a completely fresh installation, of course update package in running system is different.

Comment 5 Miro Hrončok 2025-06-12 10:28:11 UTC
That warning is not that important. The bigger issue is that this does not build with the current setuptools (No module named 'distutils.command.register') nor Python (RuntimeError: There is no current event loop in thread 'MainThread')

Comment 6 Raphael Groner 2025-06-13 05:37:53 UTC
1. Well, eco.db may be user specific so general rpm process isn't involved.

2. Because distutils was removed in Python 3.12, we get ModuleNotFoundError: module named 'distutils'.
Possible fix: dependency to setuptools - PEP 632

https://stackoverflow.com/questions/77931666/modulenotfounderror-no-module-named-distutils-how-to-solve-this-in-macos
https://peps.python.org/pep-0632/

3. CPython unbundled setuptools.
Possible fix: replace..

loop = asyncio.get_event_loop()

with..

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

https://github.com/python/cpython/issues/95299

Comment 7 Miro Hrončok 2025-06-13 09:15:56 UTC
> Because distutils was removed in Python 3.12, we get ModuleNotFoundError: module named 'distutils'.

This was already fixed back then by using setuptools, which provides its own distutils module.

However, now they have removed distutils.command.register from it.

Comment 8 Raphael Groner 2025-06-13 09:21:45 UTC
Honestly, is that intentional to break build tools?

Comment 9 Miro Hrončok 2025-06-13 15:08:52 UTC
No idea. setuptools upstream is not very interested at maintaining compatibility with old distutils. I'm not happy about that either.


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