roboflow-python icon indicating copy to clipboard operation
roboflow-python copied to clipboard

Python 3.14t + roboflow 1.2.11 is broken

Open MrMarvel opened this issue 10 months ago • 1 comments

 ~#@❯ uv venv --python 3.14t
Using CPython 3.14.0+freethreaded interpreter at: D:\Users\Sergey\AppData\Local\Python\pythoncore-3.14t-64\python3.14t.exe
Creating virtual environment at: .venv
✔ A virtual environment already exists at `.venv`. Do you want to replace it? · yes
Activate with: .venv\Scripts\activate
 ~#@❯ uv sync --extra gpu
Resolved 213 packages in 2ms
  × Failed to build `pillow-avif-plugin==1.5.2`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit code: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
          requires = get_requires_for_build({})
        File "D:\Users\Sergey\AppData\Local\uv\cache\builds-v0\.tmpCh7CGi\Lib\site-packages\setuptools\build_meta.py",
      line 331, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\Users\Sergey\AppData\Local\uv\cache\builds-v0\.tmpCh7CGi\Lib\site-packages\setuptools\build_meta.py",
      line 301, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "D:\Users\Sergey\AppData\Local\uv\cache\builds-v0\.tmpCh7CGi\Lib\site-packages\setuptools\build_meta.py",
      line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 57, in <module>
        File "<string>", line 17, in version
      AttributeError: 'Constant' object has no attribute 's'

      hint: This usually indicates a problem with the package or the build environment.
  help: `pillow-avif-plugin` (v1.5.2) was included because `yolofingers` (v0.1.0) depends on `roboflow` (v1.2.11)
        which depends on `pillow-avif-plugin`

pyproject.toml

[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = [
    "notebook~=7.0",
    "pycocotools~=2.0",
    "roboflow~=1.0",
    "torch~=2.0",
    "ultralytics~=8.0",
    "torchvision~=0.0",
    "opencv-python-headless~=4.0",
    "plotly~=6.0",
    "scikit-learn~=1.0",
    "rfdetr~=1.0",
    "tensorboard~=2.0",
    "albumentations~=2.0",
    "lightning~=2.0",
    "loguru~=0.7",
    "transformers>=4.57.3",
]

[dependency-groups]
dev = [
    "pandas-stubs~=2.0",
]

[project.optional-dependencies]
gpu = [
    "torch",
    "torchvision",
]
cpu = [
    "torch",
    "torchvision",
]

[tool.uv]
package = false
conflicts = [
    [
        { extra = "cpu" },
        { extra = "gpu" },
    ],
]

[tool.uv.sources]
torch = [
    { index = "torch_cuda", extra = "gpu" },
    { index = "torch_cpu", extra = "cpu" },
]
torchvision = [
    { index = "torch_cuda", extra = "gpu" },
    { index = "torch_cpu", extra = "cpu" },
]

[[tool.uv.index]]
name = "torch_cuda"
url = "https://download.pytorch.org/whl/cu128"
explicit = true

[[tool.uv.index]]
name = "torch_cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

Specs:

Windows 11 25H2
uv 0.9.25
Python 3.14.0t free-threading build

MrMarvel avatar Jan 15 '26 20:01 MrMarvel

I tried to reproduce this today on macOS (Apple Silicon) with main @ b9ec136 (1.7.1). Two separate things are going on:

The reported failure is fixed upstream. It was pillow-avif-plugin 1.5.2 having no free-threaded wheel and failing to build from source. pillow-avif-plugin 1.5.3 (2026-01-21, six days after this report) added cp314 and cp314t wheels, and the existing pillow-avif-plugin<2 pin resolves to them. On CPython 3.14.3 free-threaded it now installs from a wheel.

Free-threaded 3.14 still can't install from wheels, because of OpenCV. opencv-python-headless (and opencv-python) only publish cp37-abi3 stable-ABI wheels, which free-threaded interpreters can't use, so pip/uv fall back to compiling OpenCV from source. On my machine that build ran for about 10 minutes and then failed in modules/videoio against the local FFmpeg (no member named 'pix_fmts' in 'AVCodec', an FFmpeg 8 API removal). The exact error will depend on the toolchain, but the cause is the same everywhere: opencv-python has no cp314t wheels as of 5.0.0.93 / 4.14.0.94, so free-threaded installs always compile OpenCV. That's an upstream limitation, not something this package can fix beyond documenting it.

For comparison, regular CPython 3.14.7 installs roboflow from wheels in about 2 s (pillow-avif-plugin 1.6.0, opencv-python-headless 5.0.0, Pillow 12.3.0) and imports fine.

Side note: Pillow decodes AVIF natively since 11.2.1, so pillow-avif-plugin could become an optional extra the way pillow-heif did in #530. Happy to open that as a separate PR if there's interest.

Lingikaushikreddy avatar Oct 12 '26 05:10 Lingikaushikreddy