Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8015

Python • Bookworm and Python Text to Speech

$
0
0
I am experiencing considerable pushback from the OS in my efforts to implement text to speech (TTS) with Googles TTS API (GTTS) in Python. Apparently, the OS and/or Python zealously protects the Python environment. That protection prevents loading some APIs and Python libraries in the usual way. I understand that GTTS is available as a Debian package. Below is my terminal experience.

Code:

dah@rpi:~ $ pip3 install --user gTTSerror: externally-managed-environmentThis environment is externally managed> To install Python packages system-wide, try apt install    python3-xyz, where xyz is the package you are trying to    install.        If you wish to install a non-Debian-packaged Python package,    create a virtual environment using python3 -m venv path/to/venv.    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make    sure you have python3-full installed.        For more information visit http://rptl.io/venvnote: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.hint: See PEP 668 for the detailed specification.dah@rpi:~ $ apt install python3-gTTSE: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?dah@rpi:~ $ sudo apt install python3-gTTSReading package lists... DoneBuilding dependency tree... DoneReading state information... DoneE: Unable to locate package python3-gTTS
I tried using the espeak-nu engine (API?), but found it's output sounds like the voice of Stephen Hawking. I wanted a more natural sounding voice. My quest led me to try the GTTS. Sadly, I have failed to get GTTS to work in a Python script due to the above struggle to install GTTS Python library.

I am using the latest recommended fully updated Bookworm 64bit OS version on my RP 4 with 8GB of RAM.

Please tell me how to install GTTS. Thank you in advance.

Statistics: Posted by 1dahful — Mon Apr 21, 2025 3:48 pm



Viewing all articles
Browse latest Browse all 8015

Trending Articles