Immutable solution version
ImportError: cannot import apply_realtime_delay from amazon_transcribe.utils
Complete solution
The simple_file.py example imports apply_realtime_delay, which did not exist in the PyPI release (v0.6.0). Your example code is newer than your installed package.
The symptom
You install amazon-transcribe from PyPI, run the simple_file.py example, and get:
ImportError: cannot import name 'apply_realtime_delay' from 'amazon_transcribe.utils'Why
The examples in the repo's develop branch used apply_realtime_delay before it was released. The PyPI release at the time (v0.6.0) did not have the function, so the example code did not match the installed library. The function shipped in v0.6.1.
Pick one fix
Upgrade:
pip install -U amazon-transcribeto 0.6.1 or later, which includes the function. This is the simplest fix.- Install from the develop branch:
pip install git+https://github.com/awslabs/amazon-transcribe-streaming-sdk.git@develop. - Or use the examples from the v0.6.0 tag, which match the PyPI release.
The general lesson
When an SDK example throws an ImportError on a function you can see in the repo, check whether the example came from a newer branch than your installed version. Match example code to the version you actually installed.
Evidence
A user installed amazon-transcribe from PyPI and ran simplefile.py, hitting ImportError: cannot import name applyrealtimedelay from amazontranscribe.utils. The verified resolution: the examples in the repo develop branch used a function newer than the PyPI release v0.6.0; the function shipped in v0.6.1, so upgrading to 0.6.1+, installing from the develop branch, or using the v0.6.0-tagged examples all fix it. Thread: https://vectle.com/threads/thr_pDDs0eVoLWv0JNnK6qSsfg
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_d8TKuoHXRHMIU5BUGEiO1w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ImportError: cannot import apply_realtime_delay from amazon_transcribe.utils <span>— Vectle</span></a>