Open patrickjane opened 4 years ago
Same error, I too I'm working on 2.4.20, seems that the tts.py can't import google tts client libraries
[DEBUG:2242291] GoogleWaveNetSentenceSpeaker: Falling back to PicoTTSSentenceSpeaker [ERROR:2242289] GoogleWaveNetSentenceSpeaker: speak Traceback (most recent call last): File "/usr/share/rhasspy/rhasspy/tts.py", line 643, in in_ready self.wav_data = self.speak(message.sentence, voice, language_code) File "/usr/share/rhasspy/rhasspy/tts.py", line 742, in speak from google.cloud import texttospeech ImportError: cannot import name 'texttospeech' from 'google.cloud' (unknown location) [DEBUG:2242287] GoogleWaveNetSentenceSpeaker: Calling Wavenet (lang=en-US, voice=Wavenet-C, gender=MALE, rate=22050) [DEBUG:2242286] GoogleWaveNetSentenceSpeaker: Trying credentials at /profiles/en/tts/googlewavenet/Mywai-f573c55b856b.json
Same here... seems google tts module is missing?
Well at least when trying to install it by hand it says its already installed:
pi@voicebase:~/rhasspy $ source .venv/bin/activate
(.venv) pi@voicebase:~/rhasspy $ pip3 install google-cloud-speech
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: google-cloud-speech in ./.venv/lib/python3.7/site-packages (1.3.1)
Requirement already satisfied: google-api-core[grpc]<2.0.0dev,>=1.14.0 in ./.venv/lib/python3.7/site-packages (from google-cloud-speech) (1.17.0)
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (2.22.0)
Requirement already satisfied: google-auth<2.0dev,>=1.14.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (1.14.1)
Requirement already satisfied: setuptools>=34.0.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (40.8.0)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (1.51.0)
Requirement already satisfied: six>=1.10.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (1.14.0)
Requirement already satisfied: pytz in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (2019.3)
Requirement already satisfied: protobuf>=3.4.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (3.11.3)
Requirement already satisfied: grpcio<2.0dev,>=1.8.2; extra == "grpc" in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (1.28.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (1.25.9)
Requirement already satisfied: idna<2.9,>=2.5 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (2020.4.5.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in ./.venv/lib/python3.7/site-packages (from google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (0.2.8)
Requirement already satisfied: rsa<4.1,>=3.1.4 in ./.venv/lib/python3.7/site-packages (from google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (4.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in ./.venv/lib/python3.7/site-packages (from google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (4.1.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in ./.venv/lib/python3.7/site-packages (from pyasn1-modules>=0.2.1->google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech) (0.4.8)
(.venv) pi@voicebase:~/rhasspy $
forgot to clarify, i'am on the rhasspy docker image.
@patrickjane if you are running rhasspy in a docker container too: did you log into this container?
perhaps @Romkabouter can help? ;)
Edit: Ah I see now, your created a python venv
@linuxlurak nope I'm on a venv installation.
I have got the same issue, I'll see if I can fix it
I had not noticed it, because playing from cache works fine
Seems like there was a missing dependency. After pip install --upgrade google-cloud-texttospeech
it still doesnt work, however the error is different in the logs:
May 8 09:39:06 calypso rhasspy[15950]: ERROR:GoogleWaveNetSentenceSpeaker:speak
May 8 09:39:06 calypso rhasspy[15950]: Traceback (most recent call last):
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
May 8 09:39:06 calypso rhasspy[15950]: return callable_(*args, **kwargs)
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/grpc/_channel.py", line 826, in __call__
May 8 09:39:06 calypso rhasspy[15950]: return _end_unary_response_blocking(state, call, False, None)
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/grpc/_channel.py", line 729, in _end_unary_response_blocking
May 8 09:39:06 calypso rhasspy[15950]: raise _InactiveRpcError(state)
May 8 09:39:06 calypso rhasspy[15950]: grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
May 8 09:39:06 calypso rhasspy[15950]: #011status = StatusCode.INVALID_ARGUMENT
May 8 09:39:06 calypso rhasspy[15950]: #011details = "Request contains an invalid argument."
May 8 09:39:06 calypso rhasspy[15950]: #011debug_error_string = "{"created":"@1588927146.806035885","description":"Error received from peer ipv4:216.58.210.10:443","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"
May 8 09:39:06 calypso rhasspy[15950]: >
May 8 09:39:06 calypso rhasspy[15950]: The above exception was the direct cause of the following exception:
May 8 09:39:06 calypso rhasspy[15950]: Traceback (most recent call last):
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/rhasspy/tts.py", line 643, in in_ready
May 8 09:39:06 calypso rhasspy[15950]: self.wav_data = self.speak(message.sentence, voice, language_code)
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/rhasspy/tts.py", line 761, in speak
May 8 09:39:06 calypso rhasspy[15950]: response = client.synthesize_speech(synthesis_input, voice_params, audio_config)
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/google/cloud/texttospeech_v1/gapic/text_to_speech_client.py", line 322, in synthesize_speech
May 8 09:39:06 calypso rhasspy[15950]: request, retry=retry, timeout=timeout, metadata=metadata
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 143, in __call__
May 8 09:39:06 calypso rhasspy[15950]: return wrapped_func(*args, **kwargs)
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/google/api_core/retry.py", line 286, in retry_wrapped_func
May 8 09:39:06 calypso rhasspy[15950]: on_error=on_error,
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/google/api_core/retry.py", line 184, in retry_target
May 8 09:39:06 calypso rhasspy[15950]: return target()
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
May 8 09:39:06 calypso rhasspy[15950]: return func(*args, **kwargs)
May 8 09:39:06 calypso rhasspy[15950]: File "/home/pi/rhasspy/.venv/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
May 8 09:39:06 calypso rhasspy[15950]: six.raise_from(exceptions.from_grpc_error(exc), exc)
May 8 09:39:06 calypso rhasspy[15950]: File "<string>", line 3, in raise_from
May 8 09:39:06 calypso rhasspy[15950]: google.api_core.exceptions.InvalidArgument: 400 Request contains an invalid argument.
Continuing to investigate ...
Okay, found the issue. I was giving de-DE-Wavenet-C
as voice (this is shown at the google website), but rhasspy adds an additional de-DE
in front of it, making an invalid argument. I've fixed it, and now wavenet TTS works. I didn't follow the docs correctly on this parts.
This is the relevant part in profile.json:
"text_to_speech": {
"system": "wavenet",
"wavenet": {
"cache_dir": "tts/googlewavenet/cache",
"credentials_json": "tts/googlewavenet/credentials.json",
"voice": "Wavenet-C",
"url": "https://texttospeech.googleapis.com/v1/text:synthesize",
"fallback_tts": "picotts"
}
},
Good find, so I think the docker should be updated
I am not using docker, I did the venv installation.
I am not using docker, I did the venv installation.
I logged into the docker image, installed pip, the google-cloud-texttospeech library and then restarted rhasspy but I still have the same error
ImportError: cannot import name 'texttospeech' from 'google.cloud' (unknown location)
Is there a proper way to install that python libraries in the docker image?
Okay so I remember that two weeks ago I already tried to fix this, and installed some google package, but still it didnt work, so I stopped investigating. Maybe theres a second package missing.
Lets compare:
(.venv) pi@calypso:~/rhasspy $ pip list | grep google
google-api-core 1.17.0
google-auth 1.14.1
google-cloud-speech 1.3.1
google-cloud-texttospeech 1.0.1
googleapis-common-protos 1.51.0
google-api-core 1.17.0 google-auth 1.14.2 google-cloud-speech 1.3.2 google-cloud-texttospeech 1.0.1 googleapis-common-protos 1.51.0
Pretty the same for my docker image. The google-cloud-speech library was missing and I manually installed it but isn't relevant with the issue
Okay so I just did a complete new install, and for me it was fixed after manually installing google-cloud-texttospeech
.
(.venv) pi@calypso:~/rhasspy $ pip install --upgrade google-cloud-texttospeech
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting google-cloud-texttospeech
Using cached google_cloud_texttospeech-1.0.1-py2.py3-none-any.whl (50 kB)
Requirement already satisfied, skipping upgrade: google-api-core[grpc]<2.0.0dev,>=1.14.0 in ./.venv/lib/python3.7/site-packages (from google-cloud-texttospeech) (1.17.0)
Requirement already satisfied, skipping upgrade: google-auth<2.0dev,>=1.14.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (1.14.3)
Requirement already satisfied, skipping upgrade: requests<3.0.0dev,>=2.18.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (2.22.0)
Requirement already satisfied, skipping upgrade: googleapis-common-protos<2.0dev,>=1.6.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (1.51.0)
Requirement already satisfied, skipping upgrade: six>=1.10.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (1.14.0)
Requirement already satisfied, skipping upgrade: setuptools>=34.0.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (40.8.0)
Requirement already satisfied, skipping upgrade: protobuf>=3.4.0 in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (3.11.3)
Requirement already satisfied, skipping upgrade: pytz in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (2020.1)
Requirement already satisfied, skipping upgrade: grpcio<2.0dev,>=1.8.2; extra == "grpc" in ./.venv/lib/python3.7/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (1.28.1)
Requirement already satisfied, skipping upgrade: pyasn1-modules>=0.2.1 in ./.venv/lib/python3.7/site-packages (from google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (0.2.8)
Requirement already satisfied, skipping upgrade: rsa<4.1,>=3.1.4 in ./.venv/lib/python3.7/site-packages (from google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (4.0)
Requirement already satisfied, skipping upgrade: cachetools<5.0,>=2.0.0 in ./.venv/lib/python3.7/site-packages (from google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (4.1.0)
Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (2.8)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (3.0.4)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (2020.4.5.1)
Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./.venv/lib/python3.7/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (1.25.9)
Requirement already satisfied, skipping upgrade: pyasn1<0.5.0,>=0.4.6 in ./.venv/lib/python3.7/site-packages (from pyasn1-modules>=0.2.1->google-auth<2.0dev,>=1.14.0->google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-texttospeech) (0.4.8)
Installing collected packages: google-cloud-texttospeech
Successfully installed google-cloud-texttospeech-1.0.1
So after the initial installation I had:
(.venv) pi@calypso:~/rhasspy $ pip list | grep google
google-api-core 1.17.0
google-auth 1.14.3
google-cloud-speech 1.3.1
googleapis-common-protos 1.51.0
In this, google-cloud-texttospeech
was missing (not google-cloud-speech
).
I am using the hassio addon and have the same problems with wavenet tts.
GoogleWaveNetSentenceSpeaker: Falling back to EspeakSentenceSpeaker [ERROR:87465816] GoogleWaveNetSentenceSpeaker: speak Traceback (most recent call last): File "/usr/share/rhasspy/rhasspy/tts.py", line 643, in in_ready self.wav_data = self.speak(message.sentence, voice, language_code) File "/usr/share/rhasspy/rhasspy/tts.py", line 742, in speak from google.cloud import texttospeech ImportError: cannot import name 'texttospeech' from 'google.cloud' (unknown location)
Is there a solution for the addon too?
If have found the cause of this issue. Back on 7th of december this commit: https://github.com/synesthesiam/rhasspy/commit/080ba2e97fd102eab7f1165ddef3fcaa07c9191e
It sets google from true to false, causing to skip the install of the Google TTS. I have created a PR for this: https://github.com/synesthesiam/rhasspy/pull/230
PR is merged, can you retry? I do not know if the docker image is already released however.
Hello,
I am on a fresh install of 2.4.20 on a fresh install of raspbian buster, and I've just added credentials and configuration for the wavenet tts. However it always falls back to espeak.
This is what I get in the logs:
Not sure what could be wrong here?