Registry / ai-ml / pocketsphinx

pocketsphinx

JSON →
library5.1.1pypypi✓ verified 84d ago

Official Python bindings for PocketSphinx, a lightweight speech recognition engine. Current version 5.0.4. Release cadence is irregular; updates coincide with upstream changes.

pip install pocketsphinx
INSTALL
IMPORT
SIG · POCKETSPHINX
P
pocketsphinx
ai-mlpythonv5.1.1
Install
2.5s avg
Import
38ms
Disk
55MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✓ —
✓ 2.4s
py 3.12
✕ build_error
✕ build_error
py 3.13
✓ —
✓ 2.5s
py 3.9
✕ build_error
✕ build_error
55MB installed
● package 55MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pocketsphinx
import pocketsphinx
The correct import is just 'import pocketsphinx'. No module alias changed.
Decoder
from pocketsphinx import Decoder
from pocketsphinx import LiveSpeech
LiveSpeech is a convenience wrapper; Decoder is the core class for manual control.

Minimal example using Decoder to process raw audio bytes.

import pocketsphinx decoder = pocketsphinx.Decoder() decoder.start_utt('test') decoder.process_raw(b'Some audio data', False, False) decoder.end_utt() print(decoder.hypothesis())
Debug
Known issues
breakingIn v5, the module is imported as 'import pocketsphinx' (no 'pocketsphinx.pocketsphinx'). Older examples use 'from pocketsphinx.pocketsphinx import Decoder' which no longer works.
fix
Replace 'from pocketsphinx.pocketsphinx import Decoder' with 'from pocketsphinx import Decoder'.
affects: >=5.0.0
deprecatedThe 'LiveSpeech' class is deprecated in favor of using Decoder directly. It may be removed in future versions.
fix
Use Decoder with appropriate configuration instead of LiveSpeech.
affects: >=5.0.0
gotchapocketsphinx requires audio in 16-bit mono PCM format at 16000 Hz. Providing audio in other formats will silently fail or produce garbage results.
fix
Resample and convert audio before passing to Decoder. Use libraries like pydub or scipy for conversion.
affects: all
Errors
Common errors & fixes
AttributeError: module 'pocketsphinx' has no attribute 'Decoder'
Incorrect import path. The module is not a package with submodules; `import pocketsphinx` gives the module directly.
fix
Use `from pocketsphinx import Decoder` or `import pocketsphinx; decoder = pocketsphinx.Decoder()`.
pocketsphinx.pocketsphinx.Decoder not found
Old API path. v5 removed the nested package.
fix
Use `from pocketsphinx import Decoder`.
Upgrade
Version history
5.1.1latest on PyPI · released Jun 6, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
pocketsphinx — pip install pocketsphinx · libregistry