AutoGPT: In speak mode: ModuleNotFoundError: No module named 'gi'
Duplicates
- I have searched the existing issues
Steps to reproduce 🕹
- Install via vscode + devcontainer method (on WIndows), using stable branch
- Template .env with necessary API keys and ELEVENLABS voice IDs
- Start with --speak arg
speech.mpeg file is generated and saved to disk, but the below error occurs.
Current behavior 😯
Continue (y/n): Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/workspaces/Auto-GPT/autogpt/speak.py", line 112, in speak
success = eleven_labs_speech(text, voice_index)
File "/workspaces/Auto-GPT/autogpt/speak.py", line 55, in eleven_labs_speech
playsound("speech.mpeg", True)
File "/home/vscode/.local/lib/python3.8/site-packages/playsound.py", line 91, in _playsoundNix
import gi
ModuleNotFoundError: No module named 'gi'
Beyond saying y
, all further interactions are impossible (program freezes).
Expected behavior 🤔
No response
Your prompt 📝
N/A
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 10
- Comments: 27
I’m going to take a stab at this issue with the goals of:
Same issue here.
The speech synthesis function activated with --speak argument, seems to rely on a
gi
module.I managed to fix the error by adding
PyGObject
module in the requirements.txt. This is the name of the module when installed with pip (https://pypi.org/project/PyGObject/)It also requires three dependency packages to be installed using apt:
It can be done adding theses lines to the DockerFIle:
It fixed the issues but now the command hangs after the AI name (without error):
I assume this due to a missing sound interface in the docker container, which makes sense. The next step would be to find a way to mount or link the host sound device inside the container…
Unfortunately the above solution didn’t work for me.
I’m working on it now. Very frustrating… I’m on Ubuntu 22, Python 3.10, Jetson Orin Nano Arm64 server. Exact same error.
Exception in thread Thread-2 (_speak): Traceback (most recent call last): File “/usr/lib/python3.10/threading.py”, line 1016, in _bootstrap_inner self.run() File “/usr/lib/python3.10/threading.py”, line 953, in run self._target(*self._args, **self._kwargs) File “/home/truth/AutoGPT/autogpts/autogpt/autogpt/speech/say.py”, line 50, in _speak success = self._voice_engine.say(text, voice_index) File “/home/truth/AutoGPT/autogpts/autogpt/autogpt/speech/base.py”, line 39, in say return self._speech(text, voice_index) File “/home/truth/AutoGPT/autogpts/autogpt/autogpt/speech/eleven_labs.py”, line 87, in _speech playsound(“speech.mpeg”, True) File “/root/.cache/pypoetry/virtualenvs/agpt-mdKPTkzc-py3.10/lib/python3.10/site-packages/playsound.py”, line 91, in _playsoundNix import gi ModuleNotFoundError: No module named ‘gi’
I uninstalled version 1.2.2 of playsound and pip reinstalled it which grabbed version 1.3.0. This fixed the speak issue in my environment. Should this issue be closed?
As far as I know this issue remains unresolved - Commenting to remove the stale tag.
I am running Python 3.11.3 in a virtual environment within WSL2, ubuntu 20.04.
I originally was having issues as well with “gi” per the original issue description but I was able to get past that after installing pyobjc in my virtual environment:
pip install pyobjc
For reference, I am using playsound 1.2.2:
pip show playsound
This was then causing the following error to be thrown when the bot attempted to use TTS to the user:
[above code is edited to not have full path]
I was able to get past this by performing the following global in my linux environment:
sudo apt install python3-gst-1.0
This appears to get me past the errors being thrown but now it is hanging when attempting to get to the speak portion of dialog:
aborting out shows:
So at this point it seems, atleast for my situation with WSL2, that the audio may not be getting passed from Windows to the Linux Subsystem correctly. I am going to continue down the rabbit hole, but not sure if I will get anywhere. Would just be easier at this point to create a virtualbox with Ubuntu and build it in there.
Posted my information here for future prosperity
I had to uninstall and reinstall the
playsound
library (version 1.3.0 seems to work for me)See this related discussion