Skip to content

bithuman: resolve the SDK on Python 3.10 and 3.14 again - #7280

Merged
theomonnom merged 2 commits into
mainfrom
theo/bithuman-py314
Sep 15, 2026
Merged

theomonnom merged 2 commits into
mainfrom
theo/bithuman-py314

Conversation

@theomonnom

@theomonnom theomonnom commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Summary

The python_version >= '3.11' and python_version < '3.14' marker on the bithuman dependency (#6561, #6614) was correct when bithuman 2.3.11 through 2.8.0 only shipped cp311–cp313 wheels. bithuman 2.8.1 (2026-08-01) restored cp310 and cp314 wheels and declares Requires-Python: >=3.10,<3.15, and every release since (2.9.0, 3.x) does the same. The marker now leaves the plugin installed without its SDK on Python 3.10 and 3.14.

Changes:

  • Drop the marker; the dependency is back to bithuman>=0.5.25,<3.
  • Add the Programming Language :: Python :: 3.14 classifier, matching livekit-agents.
  • uv lock --upgrade-package bithuman: 2.7.0 → 2.9.0, the newest 2.x with wheels for every supported interpreter. 2.9.0 dropped its networkx dependency, which is why that package leaves the lock.
  • Remove print_unsupported_python and the two try/except ImportError wrappers that called it. That helper existed only to explain the SDK's absence on the versions the marker excluded; with the marker gone it fires on any ImportError and blames the interpreter for unrelated failures.
  • Declare pillow>=10.3.0.

Not changed: the <3 upper bound. bithuman 3.0.0 shipped on 2026-09-07 and has not been checked against avatar.py, so that belongs in its own PR.

The pillow fix

Removing the wrapper exposed a pre-existing bug it had been swallowing. avatar.py imports PIL at module scope, but the package never declared pillow, so importing the plugin raised ModuleNotFoundError: No module named 'PIL' on every Python version unless something else in the environment happened to pull Pillow in. Reproduced against unmodified main on CPython 3.13, a fully supported version:

File ".../livekit/plugins/bithuman/__init__.py", line 24, in <module>
    from .avatar import AvatarSession, BitHumanException
File ".../livekit/plugins/bithuman/avatar.py", line 16, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

The old wrapper caught this, called print_unsupported_python(), which printed nothing on 3.13 and re-raised — which is exactly the misdiagnosis the helper's removal is meant to avoid. livekit-plugins-lemonslice, the only other plugin importing PIL, declares pillow>=10.3.0; this matches it.

Verification

  • uv pip install of the plugin on CPython 3.14.7 and 3.10.18: both resolve bithuman==2.9.0 and pillow==12.3.0, and from livekit.plugins.bithuman import AvatarSession, BitHumanException succeeds on both.
  • uv lock --check passes; ruff check and ruff format --check pass.

Reported in Slack: https://live-kit.slack.com/archives/C05P6DRC6MV/p1789407534492229

🤖 Generated with Claude Code

@theomonnom
theomonnom requested a review from a team as a code owner September 14, 2026 22:39
devin-ai-integration[bot]

This comment was marked as resolved.

# stays wide so platforms 2.x dropped (Windows, x86_64 macOS, macOS < 14) can
# still resolve the 1.x line, which satisfies everything avatar.py calls.
# bithuman 2.8.1+ ships wheels for every Python livekit-agents supports (3.10
# through 3.14), so the dependency no longer needs a python_version marker. The

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove bithuman comment here?

The python_version marker on the bithuman dependency was added in #6561
and #6614 because bithuman 2.3.11 through 2.8.0 only built for Python
3.11-3.13. bithuman 2.8.1 (August 2026) restored cp310 and cp314 wheels
and declares >=3.10,<3.15, so the marker now wrongly leaves the plugin
without its SDK on 3.10 and 3.14. Drop the marker, add the 3.14
classifier, and move the lock from 2.7.0 to 2.9.0, the newest 2.x with
wheels for every supported interpreter.
Review feedback on the marker removal.

print_unsupported_python existed only to explain the SDK's absence on the
versions the marker excluded. With the marker gone it fires on any
ImportError and blames the interpreter for unrelated failures, so both it
and the two try/except wrappers go, letting the real error propagate.

Doing that exposed a pre-existing bug the wrapper had been swallowing:
avatar.py imports PIL at module scope but the package never declared
pillow, so the import failed on every Python version, 3.13 included.
Declare it the way livekit-plugins-lemonslice does.

Also drop the dependency comment, which described a marker that no longer
exists.
@theomonnom
theomonnom merged commit 068971f into main Sep 15, 2026
23 checks passed
@theomonnom
theomonnom deleted the theo/bithuman-py314 branch September 15, 2026 22:08
sgu-bithuman added a commit to bithuman-product/public-docs that referenced this pull request Sep 19, 2026
…n, and the pages said so only half

The plugin is LiveKit's package, published from github.com/livekit/agents. Both
its failure modes are ours to document even though neither is ours to fix.
Driven today in five fresh venvs, PyPI 1.8.2, nothing else installed:

  py3.11/3.12/3.13   pip ok, then ModuleNotFoundError: No module named 'PIL'
                     (avatar.py:16 `from PIL import Image`, never declared)
  py3.10/3.14        pip ok, NO bithuman installed at all, then
                     ModuleNotFoundError: No module named 'cv2'
                     (the marker `python_version >= "3.11" and < "3.14"`, now
                     stale — bithuman 2.11.3 publishes cp310 AND cp314)

`/guides/deploy-livekit` already said `pip install livekit-plugins-bithuman
pillow`, which is why its reader was safe — on 3.11-3.13. It did not say that
the SAME line still fails on 3.10 and 3.14, where the missing module is `cv2`,
not `PIL`. Measured, and now a table on the page:

  pip install livekit-plugins-bithuman           3.11-3.13 PIL   · 3.10/3.14 cv2
  … pillow                                       3.11-3.13 works · 3.10/3.14 cv2
  … pillow bithuman                              3.11-3.13 works · 3.10/3.14 works

Naming `bithuman` yourself is the whole 3.10/3.14 workaround: the wheel installs
and imports cleanly on both, so the marker is stale rather than protective.

★NO UPSTREAM PR IS NEEDED — BOTH FIXES ARE ALREADY MERGED AND MERELY
UNRELEASED. livekit/agents#7280 (`068971fe`, 2026-09-15 15:08 -0700) adds
`pillow>=10.3.0` and drops the marker, about four hours after the 1.8.2 release
commit was cut. Verified by cloning the repo, applying the proposed patch on top
of origin/main (`e5024c76`) and getting an EMPTY diff, then building a wheel
from main and importing it on 3.10, 3.12 and 3.14 — ok on all three. The ask to
LiveKit is a patch release, not a patch. Both pages say so now, so a reader
knows the workarounds have an expiry.

Also: the plugin release is 1.8.2, not 1.8.1, and `bithuman<3` resolves 2.11.3
today, not 2.3.4. Both were named on /sdk/livekit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NoF6sY6vvij3uDYUxnyCri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants