Skip to content

fix: make pyaudio an optional [client] extra so headless installs work - #1304

Open
MushiSenpai wants to merge 1 commit into
fishaudio:mainfrom
MushiSenpai:fix/pyaudio-optional-dependency
Open

fix: make pyaudio an optional [client] extra so headless installs work#1304
MushiSenpai wants to merge 1 commit into
fishaudio:mainfrom
MushiSenpai:fix/pyaudio-optional-dependency

Conversation

@MushiSenpai

Copy link
Copy Markdown

Move pyaudio to an optional client extra so headless / slim / API-only installs work.

pyaudio is a core dependency, but it needs the system PortAudio headers
(portaudio19-dev) to build — so pip install of fish-speech fails on slim
containers, CPU-only boxes, and any environment that only needs the API/server, not
local audio playback. PyAudio is used in exactly one place: native streaming playback
in tools/api_client.py.

Changes

  • pyproject.toml — remove pyaudio from core dependencies; add a client
    optional-dependency group (client = ["pyaudio"]).
  • tools/api_client.py — drop the module-level import pyaudio; import it lazily
    inside the --streaming playback branch, with a friendly ImportError pointing to
    pip install -e .[client].

No behavior change for users who already have PyAudio installed; headless/slim installs
now succeed, and only hit the requirement if they actually use streaming playback.

(Same spirit as the input-validation hardening in #1303.)


Disclosure: drafted with AI assistance (Claude); reviewed and submitted by me. The commit carries a Co-Authored-By trailer.

pyaudio is a core dependency but needs system PortAudio headers to build, so
pip install fails on slim / CPU-only / API-only environments. It is used only for
native streaming playback in tools/api_client.py.

- pyproject.toml: drop pyaudio from core dependencies; add client = ["pyaudio"].
- tools/api_client.py: remove the module-level import; import pyaudio lazily inside
  the --streaming branch with a friendly ImportError pointing to pip install -e .[client].

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale label Jul 29, 2026
@MushiSenpai

MushiSenpai commented Aug 13, 2026

Copy link
Copy Markdown
Author

Still applies to current main: pyaudio is still a core dependency (pyproject.toml:40), but it is only used for --play streaming playback in tools/api_client.py. That means every headless / slim / CPU / API-only install has to build PortAudio for a client-only feature, which is a common cause of install failures in containers.

This moves it to an optional [client] extra and makes the import lazy behind the playback branch, with a friendly ImportError pointing at pip install -e .[client] — so the playback path still works for anyone who wants it. Happy to rebase if useful.

@github-actions github-actions Bot removed the stale label Aug 14, 2026
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.

1 participant