googleapis / google-cloud-python

Google Cloud Client Library for Python
https://googleapis.github.io/google-cloud-python/
Apache License 2.0
4.85k stars 1.53k forks source link

[Speech] TypeError: __call__() got multiple values for keyword argument 'timeout' #4820

Closed akmalmzamri closed 6 years ago

akmalmzamri commented 6 years ago
  1. Specify the API at the beginning of the title (for example, "BigQuery: ...") General, Core, and Other are also allowed as types google-cloud-speech
  2. OS type and version 0.31.0
  3. Python version and virtual environment information python --version 2.7.3
  4. google-cloud-python version pip show google-cloud, pip show google-<service> or pip freeze

altgraph==0.15 asn1crypto==0.23.0 aspy.yaml==1.0.0 backports-abc==0.5 backports.ssl-match-hostname==3.5.0.1 cached-property==1.3.1 cachetools==2.0.1 certifi==2018.1.18 cffi==1.11.2 chardet==3.0.4 click==6.7 cryptography==2.1.4 dill==0.2.7.1 dis3==0.1.2 enum34==1.1.6 future==0.16.0 futures==3.2.0 google-api-core==0.1.4 google-auth==1.3.0 google-cloud-core==0.28.0 google-cloud-speech==0.31.0 google-cloud-translate==1.3.0 google-gax==0.15.16 googleapis-common-protos==1.5.3 grpcio==1.8.6 identify==1.0.7 idna==2.6 ipaddress==1.0.18 lxml==4.1.1 macholib==1.9 monotonic==1.4 nodeenv==1.2.0 pefile==2017.11.5 pluggy==0.6.0 ply==3.8 pre-commit==1.4.5 protobuf==3.5.1 py==1.5.2 pyasn1==0.4.2 pyasn1-modules==0.2.1 PyAudio==0.2.11 pycparser==2.18 PyInstaller==3.3.1 pyOpenSSL==17.5.0 pyttsx==1.1 pytz==2017.3 PyYAML==3.12 requests==2.18.4 rsa==3.4.2 singledispatch==3.4.0.3 six==1.11.0 SpeechRecognition==3.8.1 tenacity==4.7.1 tornado==4.5.2 tox==2.9.1 translate==3.5.0 urllib3==1.22 virtualenv==15.1.0 ws4py==0.4.2

  1. Stacktrace if available

Traceback (most recent call last): File "transcribe_streaming_mic.py", line 195, in main() File "transcribe_streaming_mic.py", line 187, in main for responses in client.streaming_recognize(streaming_config, requests,): File "/home/sarif/.local/lib/python2.7/site-packages/google/cloud/speech_v1/helpers.py", line 69, in streaming_recognize options, File "/home/sarif/.local/lib/python2.7/site-packages/google/api_core/gapic_v1/method.py", line 139, in call return wrapped_func(*args, kwargs) File "/home/sarif/.local/lib/python2.7/site-packages/google/api_core/retry.py", line 260, in retry_wrapped_func on_error=on_error, File "/home/sarif/.local/lib/python2.7/site-packages/google/api_core/retry.py", line 177, in retry_target return target() File "/home/sarif/.local/lib/python2.7/site-packages/google/api_core/timeout.py", line 206, in func_with_timeout return func(*args, *kwargs) File "/home/sarif/.local/lib/python2.7/site-packages/google/api_core/grpc_helpers.py", line 73, in error_remappedcallable result = callable(args, kwargs) TypeError: call() got multiple values for keyword argument 'timeout'

  1. Steps to reproduce Run the sample code below

  2. Code example https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/cloud-client/transcribe_streaming_mic.py

chemelnucfin commented 6 years ago

This is only a python2 issue.

python3 shows a different issue.

ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
Traceback (most recent call last):
  File "temp.py", line 187, in <module>
    main()
  File "temp.py", line 183, in main
    listen_print_loop(responses)
  File "temp.py", line 122, in listen_print_loop
    for response in responses:
  File "/usr/local/lib/python3.5/dist-packages/grpc/_channel.py", line 363, in __next__
    return self._next()
  File "/usr/local/lib/python3.5/dist-packages/grpc/_channel.py", line 357, in _next
    raise self
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, Client GRPC deadline too short. Should be at least: 3 * audio-duration + 5 seconds. Current deadline is: 189.99892939976417 second(s). Required at least: 196 second(s).)>

Looking at the python2 issue now.

chemelnucfin commented 6 years ago

Hello, I have fixed the code for python3 and you can follow it here: python-docs-samples/1340.

Given our limited resources, I will now close this issue and would like to suggest that you use python3 since the bug fix for python2 was not obvious. I will track this in our projects, however.

If you must use python2, please do let me know and I will see if I can find some time to work on it. Thank you.

akmalmzamri commented 6 years ago

Yes, unfortunately, the device that I'm running the script on can't run Python 3. Would be cool if you can look into the Python 2 issue as well. Thanks

chemelnucfin commented 6 years ago

@akmalhakimi1991 @jonparrott has fixed the helpers problem. Sorry about that!

akmalmzamri commented 6 years ago

Is that supposed to fix this issue? I tried just now and I still see the issue. I already uninstall and reinstall the package (including upgrading grpcio to 1.9.0)

chemelnucfin commented 6 years ago

@akmalhakimi1991 Hello, I believe we need to put out a new release to get the release out to you. I'm not completely sure how often we put out new releases. @jonparrott Could you let me know that?

theacodes commented 6 years ago

We release as often as we need. Feel free to draft a release PR for speech.

On Mon, Feb 5, 2018, 9:35 PM chemelnucfin notifications@github.com wrote:

@akmalhakimi1991 https://github.com/akmalhakimi1991 Hello, I believe we need to put out a new release to get the release out to you. I'm not completely sure how often we put out new releases. @jonparrott https://github.com/jonparrott Could you let me know that?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/google-cloud-python/issues/4820#issuecomment-363316070, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPUcwr9sRsMPLnyUj_HSai-yErMBqLXks5tR-SOgaJpZM4R1Il_ .

GaheeK commented 6 years ago

@chemelnucfin

Hi, I am having a same problem with python3 (using pyenv virtualenv) OS type : mac OS ver. 10.12.6 Python : Python 3.6.2 ( using pyenv vertualenv ) pip freeze

cachetools==2.0.1
certifi==2018.1.18
chardet==3.0.4
google-api-core==0.1.4
google-auth==1.3.0
google-cloud-speech==0.31.0
googleapis-common-protos==1.5.3
grpcio==1.9.1
idna==2.6
protobuf==3.5.1
pyasn1==0.4.2
pyasn1-modules==0.2.1
PyAudio==0.2.11
pytz==2017.3
requests==2.18.4
rsa==3.4.2
six==1.11.0
urllib3==1.22

Using the code sample, https://github.com/chemelnucfin/python-docs-samples/blob/59e5d1715598c73e6b9f4bb307bcb7970fad9e86/speech/cloud-client/transcribe_streaming_mic.py I got an error message

Traceback (most recent call last):
  File "test.py", line 193, in <module>
    main()
  File "test.py", line 186, in main
    responses = client.streaming_recognize(streaming_config, requests)
  File "/Users/gahee/.pyenv/versions/py36_seba/lib/python3.6/site-packages/google/cloud/speech_v1/helpers.py", line 69, in streaming_recognize
    options,
  File "/Users/gahee/.pyenv/versions/py36_seba/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py", line 139, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Users/gahee/.pyenv/versions/py36_seba/lib/python3.6/site-packages/google/api_core/retry.py", line 260, in retry_wrapped_func
    on_error=on_error,
  File "/Users/gahee/.pyenv/versions/py36_seba/lib/python3.6/site-packages/google/api_core/retry.py", line 177, in retry_target
    return target()
  File "/Users/gahee/.pyenv/versions/py36_seba/lib/python3.6/site-packages/google/api_core/timeout.py", line 206, in func_with_timeout
    return func(*args, **kwargs)
  File "/Users/gahee/.pyenv/versions/py36_seba/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 73, in error_remapped_callable
    result = callable_(*args, **kwargs)
TypeError: __call__() got multiple values for argument 'timeout'

Do you have any idea why this is happening with python3?

GaheeK commented 6 years ago

I downgraded google-cloud-speech from 0.31.0 to 0.27.0 and it worked.

pip install google-cloud-speech == 0.27.0 
theacodes commented 6 years ago

Our apologies, we fixed the issue but failed to cut a release. Version 0.31.1 will fix this, the release PR is here: https://github.com/GoogleCloudPlatform/google-cloud-python/pull/4848

chemelnucfin commented 6 years ago

Sorry, I was taking care of other issues and was going to do it today. Apologize for the delay and thanks @jonparrott.