GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — speech_streaming tests do not pass · Issue #403 · GoogleCloudPlatform/python-docs-samples

speech_streaming tests do not pass #403

New issue
Copy link
New issue
Copy link
Closed
Closed
speech_streaming tests do not pass#403
Copy link
Labels
🚨This issue needs some love.triage meI really want to be triaged.

Description

@raphael0202
raphael0202
opened on Jul 5, 2016
Issue body actions

After installing the required dependencies, the tests of the streaming Speech API don't pass. The live speech recognition (speech_streaming.py) also don't work: no error is raised, but no response from the Google Cloud server is received, even if Streaming RecognizeRequest are sent regularly.

(googlecloud) raphael@debian-raphael:~/Documents/Projets/ZebrIA/python-docs-samples/speech/api$ python -m pytest speech_streaming_test.py
================================================================================== test session starts ===================================================================================
platform linux2 -- Python 2.7.9, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/raphael/Documents/Projets/ZebrIA/python-docs-samples/speech/api, inifile:
collected 1 items

speech_streaming_test.py F

======================================================================================== FAILURES ========================================================================================
_______________________________________________________________________________________ test_main ________________________________________________________________________________________

resource = <function at 0x7fedc94b3668>, monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7fedc94b97e8>
capsys = <_pytest.capture.CaptureFixture instance at 0x7fedc94b97a0>

@pytest.mark.skipif(
        sys.version_info >= (3, 0),
        reason=("grpc doesn't yet support python3 "
                'https://github.com/grpc/grpc/issues/282'))
def test_main(resource, monkeypatch, capsys):
    monkeypatch.setattr(
        speech_streaming, 'record_audio',
        mock_audio_stream(resource('quit.raw')))
    monkeypatch.setattr(speech_streaming, 'DEADLINE_SECS', 5)

    speech_streaming.main()

speech_streaming_test.py:70:


speech_streaming.py:141: in main
request_stream(stop_audio), DEADLINE_SECS))
speech_streaming.py:117: in listen_print_loop
for resp in recognize_stream:


self = <grpc.framework.crust._control.Rendezvous object at 0x7fedc94ce790>

def next(self):
  with self._condition:
    while True:
      if self._termination.abortion_error is not None:
        raise self._termination.abortion_error

E LocalError: LocalError(code=StatusCode.UNIMPLEMENTED, details="GRPC target method is not implemented.")

/home/raphael/.virtualenvs/googlecloud/local/lib/python2.7/site-packages/grpc/framework/crust/_control.py:415: LocalError

Activity

  1. theacodes commented on Jul 6, 2016

    @theacodes
    theacodes
    on Jul 6, 2016
    Contributor
    More actions

    We merged a version of the sample that was using an internal-only version of the API. We've reverted that change. Can you try this again with the latest code?

  2. theacodes
    added
    bug
    API/client update
    on Jul 6, 2016
  3. theacodes commented on Jul 6, 2016

    @theacodes
    theacodes
    on Jul 6, 2016
    Contributor
    More actions

    (closing, but feel free to respond and I'll re-open if needed)

  4. theacodes
    closed this as completedon Jul 6, 2016
  5. raphael0202 commented on Jul 6, 2016

    @raphael0202
    raphael0202
    on Jul 6, 2016
    Author
    More actions

    An import error occurs, because in speech_streaming.py, the module name was not corrected during the import.
    from google.cloud.speech.v1beta1 import cloud_speech_pb2 as cloud_speech
    instead of google.cloud.speech.v1

    After fixing this ImportError, I get another one:

    (googlecloud) raphael@debian-raphael:~/ZebrIA/python-docs-samples/speech/api$ python -m pytest speech_streaming_test.py
    ======================================================================== test session starts =========================================================================
    platform linux2 -- Python 2.7.9, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
    rootdir: /home/raphael/Documents/Projets/ZebrIA/python-docs-samples/speech/api, inifile:
    collected 1 items

    speech_streaming_test.py F

    ============================================================================== FAILURES ==============================================================================
    _____________________________________________________________________________ test_main ______________________________________________________________________________

    resource = <function at 0x7f62f2f2e668>, monkeypatch = <_pytest.monkeypatch.monkeypatch instance at 0x7f62f2f39830>
    capsys = <_pytest.capture.CaptureFixture instance at 0x7f62f2f397a0>

    @pytest.mark.skipif(
            sys.version_info >= (3, 0),
            reason=("grpc doesn't yet support python3 "
                    'https://github.com/grpc/grpc/issues/282'))
    def test_main(resource, monkeypatch, capsys):
        monkeypatch.setattr(
            speech_streaming, 'record_audio',
            mock_audio_stream(resource('quit.raw')))
        monkeypatch.setattr(speech_streaming, 'DEADLINE_SECS', 5)
    
      speech_streaming.main()
    

    speech_streaming_test.py:70:


    speech_streaming.py:139: in main
    service.Recognize(request_stream(stop_audio), DEADLINE_SECS))
    /home/raphael/.virtualenvs/googlecloud/local/lib/python2.7/site-packages/grpc/beta/_stub.py:57: in getattr
    return getattr(self._delegate, attr)


    self = <grpc.framework.crust.implementations._DynamicStub object at 0x7f62f21e32d0>, attr = 'Recognize'

    def __getattr__(self, attr):
      method_cardinality = self._cardinalities.get(attr)
      if method_cardinality is cardinality.Cardinality.UNARY_UNARY:
        return _UnaryUnaryMultiCallable(self._end, self._group, attr, self._pool)
      elif method_cardinality is cardinality.Cardinality.UNARY_STREAM:
        return _UnaryStreamMultiCallable(self._end, self._group, attr, self._pool)
      elif method_cardinality is cardinality.Cardinality.STREAM_UNARY:
        return _StreamUnaryMultiCallable(self._end, self._group, attr, self._pool)
      elif method_cardinality is cardinality.Cardinality.STREAM_STREAM:
        return _StreamStreamMultiCallable(
            self._end, self._group, attr, self._pool)
      else:
    
      raise AttributeError('_DynamicStub object has no attribute "%s"!' % attr)
    

    E AttributeError: _DynamicStub object has no attribute "Recognize"!

  6. theacodes commented on Jul 6, 2016

    @theacodes
    theacodes
    on Jul 6, 2016
    Contributor
    More actions

    I can't debug any further, @xinjiez @jerjou any ideas?

    (jerjou is ostensibly out until mid-next week, but ccing him just in case)

  7. theacodes commented on Jul 6, 2016

    @theacodes
    theacodes
    on Jul 6, 2016
    Contributor
    More actions

    @puneith as well.

  8. theacodes commented on Jul 6, 2016

    @theacodes
    theacodes
    on Jul 6, 2016
    Contributor
    More actions

    @raphael0202 does the sample itself work if you run it directly?

  9. raphael0202 commented on Jul 6, 2016

    @raphael0202
    raphael0202
    on Jul 6, 2016
    Author
    More actions

    @jonparrott I have the same error if I run speech_streaming.py directly:

    Traceback (most recent call last):
    File "speech_streaming.py", line 147, in
    main()
    File "speech_streaming.py", line 139, in main
    service.Recognize(request_stream(stop_audio), DEADLINE_SECS))
    File "/home/raphael/.virtualenvs/googlecloud/local/lib/python2.7/site-packages/grpc/beta/_stub.py", line 57, in getattr
    return getattr(self._delegate, attr)
    File "/home/raphael/.virtualenvs/googlecloud/local/lib/python2.7/site-packages/grpc/framework/crust/implementations.py", line 271, in getattr
    raise AttributeError('_DynamicStub object has no attribute "%s"!' % attr)
    AttributeError: _DynamicStub object has no attribute "Recognize"!

  10. theacodes commented on Jul 6, 2016

    @theacodes
    theacodes
    on Jul 6, 2016
    Contributor
    More actions

    Great, just making sure. And you are on the latest HEAD of master, right?

  11. theacodes
    reopened this on Jul 6, 2016
  12. xinjiez commented on Jul 6, 2016

    @xinjiez
    xinjiez
    on Jul 6, 2016
    Contributor
    More actions

    Could you please do this
    pip install -r requirements-speech_grpc.txt

    and use google.cloud.speech.v1 instead of google.cloud.speech.v1beta1 and see if it fixes the problem?

    Because we rollback please refer to the original README and run the instructions again. Sorry for the inconvenience.

    Thanks.

  13. raphael0202 commented on Jul 6, 2016

    @raphael0202
    raphael0202
    on Jul 6, 2016
    Author
    More actions

    Yes, latest HEAD on master branch. Did you manage to reproduce the bug?
    By the way, I don't know if you previously noticed this info in my previous message, but I had to manually fix an ImportError in speech_streaming.py:

    Traceback (most recent call last):
    File "speech_streaming.py", line 22, in
    from google.cloud.speech.v1 import cloud_speech_pb2 as cloud_speech
    ImportError: No module named v1

  14. raphael0202 commented on Jul 6, 2016

    @raphael0202
    raphael0202
    on Jul 6, 2016
    Author
    More actions

    Ok, I used pip install -r requirements-speech_grpc.txt

    Requirement already satisfied (use --upgrade to upgrade): gcloud==0.17.0 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from -r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): grpcio==0.14.0 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from -r requirements-speech_grpc.txt (line 2))
    Requirement already satisfied (use --upgrade to upgrade): PyAudio==0.2.9 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from -r requirements-speech_grpc.txt (line 3))
    Collecting grpc-google-cloud-speech==1.0.4 (from -r requirements-speech_grpc.txt (line 4))
      Downloading grpc_google_cloud_speech-1.0.4-py2.py3-none-any.whl
    Requirement already satisfied (use --upgrade to upgrade): gax-google-logging-v2>=0.7.10 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): oauth2client>=2.0.1 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): httplib2>=0.9.1 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): google-gax>=0.12.1 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): protobuf!=3.0.0.b2.post1,>=3.0.0b2 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): googleapis-common-protos in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): gax-google-pubsub-v1>=0.7.10 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): six in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): enum34>=1.0.4 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from grpcio==0.14.0->-r requirements-speech_grpc.txt (line 2))
    Requirement already satisfied (use --upgrade to upgrade): futures>=2.2.0 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from grpcio==0.14.0->-r requirements-speech_grpc.txt (line 2))
    Requirement already satisfied (use --upgrade to upgrade): grpc-google-logging-v2>=0.7.11 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gax-google-logging-v2>=0.7.10->gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from oauth2client>=2.0.1->gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from oauth2client>=2.0.1->gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from oauth2client>=2.0.1->gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): ply==3.8 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from google-gax>=0.12.1->gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): setuptools in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from protobuf!=3.0.0.b2.post1,>=3.0.0b2->gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Requirement already satisfied (use --upgrade to upgrade): grpc-google-pubsub-v1>=0.7.11 in /home/raphael/.virtualenvs/googlecloud/lib/python2.7/site-packages (from gax-google-pubsub-v1>=0.7.10->gcloud==0.17.0->-r requirements-speech_grpc.txt (line 1))
    Installing collected packages: grpc-google-cloud-speech
    Successfully installed grpc-google-cloud-speech-1.0.4
    

    But now everything works, both the tests and the script.

  15. theacodes commented on Jul 6, 2016

    @theacodes
    theacodes
    on Jul 6, 2016
    Contributor
    More actions

    It did install grpc-google-cloud-speech-1.0.4. So is this resolved?

  16. theacodes
    closed this as completedon Jul 6, 2016
  17. raphael0202 commented on Jul 6, 2016

    @raphael0202
    raphael0202
    on Jul 6, 2016
    Author
    More actions

    Yes indeed. And yes this is resolved. Thanks!

  18. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 6, 2020
  19. msampathkumar
    added 2 commits that reference this issue on Nov 14, 2022

    fix: require python 3.7+ (#403)

    df94b94

    chore(deps): update dependency google-cloud-storage to v2.3.0 (#403)

    cca6c6a
  20. telpirion
    added a commit that references this issue on Jan 18, 2023

    chore(deps): update dependency google-cloud-dialogflow to v2.8.1 (#403)

    31372d0
  21. dandhlee
    added a commit that references this issue on Feb 6, 2023

    chore(deps): update dependency google-cloud-dialogflow to v2.8.1 (#403)

    a2c7d7c
  22. telpirion
    added a commit that references this issue on Mar 13, 2023

    chore(deps): update dependency google-cloud-dialogflow to v2.8.1 (#403)

    78a2441
  23. dizcology
    added a commit that references this issue on Jun 16, 2023

    chore(deps): update dependency pytest to v7.2.0 (#403)

    e149732
  24. dizcology
    added a commit that references this issue on Jul 10, 2023

    chore(deps): update dependency pytest to v7.2.0 (#403)

    92f84cb
  25. leahecole
    added a commit that references this issue on Jul 11, 2023

    chore(deps): update dependency pytest to v7.2.0 (#403)

    e320af1
  26. chalmerlowe
    added a commit that references this issue on Feb 18, 2026

    chore(deps): update dependency pytest to v7.2.1 (#403)

    c0eded0
  27. iennae
    added a commit that references this issue on Feb 26, 2026

    chore: migrate code from googleapis/python-datastore (#13837)

    6dc735a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.