You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ImportError when attempting to test with Python 3.14 #302
Trying to run the tests with Python 3.14, I run into ImportError. This is new, doesn't happen with Python 3.13.
I test with Python 3.14, because I prepare an update of the main Python in Fedora Linux 43 and try to rebuild all Python packages as such.
$ tox -e py314
py314: commands[0]> pytest --cov=lz4/block --cov=lz4/frame --tb=long tests/block tests/frame
ImportError while loading conftest '/home/ksurma/dev/python-lz4/tests/frame/conftest.py'.
tests/frame/conftest.py:2: in <module>
import lz4.frame as lz4frame
lz4/frame/__init__.py:30: in <module>
from . import _compression
E ImportError: cannot import name '_compression' from partially initialized module 'lz4.frame' (most likely due to a circular import) (/home/ksurma/dev/python-lz4/lz4/frame/__init__.py)
Or just on an installed project in Python 3.14 venv:
$ python
>>> import lz4.frame as lz4frame
Traceback (most recent call last):
File "/home/ksurma/dev/python-lz4/lz4/frame/__init__.py", line 28, in <module>
import _compression # Python 3.6 and later
^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_compression'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import lz4.frame as lz4frame
File "/home/ksurma/dev/python-lz4/lz4/frame/__init__.py", line 30, in <module>
from . import _compression
ImportError: cannot import name '_compression' from partially initialized module 'lz4.frame' (most likely due to a circular import) (/home/ksurma/dev/python-lz4/lz4/frame/__init__.py)
Reacted by karlicoss, Daniel Hrisca, Christian Clauss, Michael Grupp, Mattias Josefsson and Eric Buehl
<frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled
to load module 'lz4._version', which has not declared that it can run safely without the GIL.
To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0
or -Xgil=0.
Activity
hroncok commentedon May 29, 2025
From https://peps.python.org/pep-0784/
Here:
python-lz4/lz4/frame/__init__.py
Lines 27 to 30 in 022d538
It goes to the second import (which is likely broken, as it was not used since Python 3.5?).
hroncok commentedon May 29, 2025
should do on Python 3.14+
hroncok commentedon May 29, 2025
Considering
python-lz4/setup.py
Line 174 in 022d538
The
from . import _compressionfallback is likely not needed.Build wheels for Python 3.14
cclauss commentedon Sep 24, 2025
%
uvx --with=lz4 python3.14t -c"import lz4"Reviews please on the solution proposed in:
cclauss commentedon Oct 7, 2025
Python 3.14 (the π version) was released today.
https://www.python.org/downloads/release/python-3140/
https://github.com/actions/python-versions/releases
cclauss commentedon Oct 12, 2025
@corona10 This is green ✅ at the bottom of https://ft-checker.com/?search=lz4 but is not really usable on Py4.13.
Build wheels for Python 3.14
Build wheels for Python 3.14