indygreg / python-zstandard

Python bindings to the Zstandard (zstd) compression library
BSD 3-Clause "New" or "Revised" License
499 stars 86 forks source link

Python 3.13 support #210

Open Gallaecio opened 10 months ago

Gallaecio commented 10 months ago

Installing on Python 3.13 (both alpha 1 and alpha 2) currently fails as follows:

$ python3.13 -m venv venv
$ . venv/bin/activate
$ pip install zstandard
Collecting zstandard
  Downloading zstandard-0.22.0.tar.gz (660 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 660.7/660.7 kB 8.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      <string>:37: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      <string>:38: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      Traceback (most recent call last):
        File "/home/user/venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/user/venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/user/venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-zejqvvc_/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-zejqvvc_/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-zejqvvc_/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-zejqvvc_/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 106, in <module>
        File "/tmp/pip-install-uzfqhs9l/zstandard_ed682faacb514d2a849026131c25d661/make_cffi.py", line 161, in <module>
          ffi = cffi.FFI()
                ^^^^^^^^^^
        File "/tmp/pip-build-env-zejqvvc_/overlay/lib/python3.13/site-packages/cffi/api.py", line 48, in __init__
          import _cffi_backend as backend
      ImportError: /tmp/pip-build-env-zejqvvc_/overlay/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so: undefined symbol: _PyThreadState_UncheckedGet
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
$
wRAR commented 10 months ago
 ImportError: /tmp/pip-build-env-zejqvvc_/overlay/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so: undefined symbol: _PyThreadState_UncheckedGet

Looks like a problem with cffi.

graingert commented 8 months ago

fixed in https://github.com/python-cffi/cffi/pull/24 but not released yet

hugovk commented 3 weeks ago

CFFI 1.17.0 has been released with Python 3.13 support: https://github.com/python-cffi/cffi/releases/tag/v1.17.0

And zstandard now installs on Python 3.13:

❯ python3.13 -m venv venv

❯ . venv/bin/activate

❯ pip install zstandard
Collecting zstandard
  Downloading zstandard-0.23.0-cp313-cp313-macosx_11_0_arm64.whl.metadata (3.0 kB)
Downloading zstandard-0.23.0-cp313-cp313-macosx_11_0_arm64.whl (633 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 633.4/633.4 kB 17.2 MB/s eta 0:00:00
Installing collected packages: zstandard
Successfully installed zstandard-0.23.0