[Python] Trying to run googlesamples-assistant-pushtotalk results in syntax error after hours...

Discussão em 'Python' iniciado por Stack, Maio 24, 2025.

  1. Stack

    Stack Membro Participativo

    So I've been building a smart mirror that (hopefully) uses google-cloud-console to integrate google assistant to a raspberry pi for voice command. I am not a programmer. Long story short, google-assistant-pushtotalk required a python version <=3.9. Installed python 3.8.20 via pyenv. In the end I'm left with a syntax error when trying to run. Here are the steps I took.

    On first execution, the following error was given.

    mirror@raspberrypi:~/.pyenv/versions/3.8.20/bin $ ~/.pyenv/versions/3.8.20/bin/googlesamples-assistant-pushtotalk
    Traceback (most recent call last):
    File "/home/mirror/.pyenv/versions/3.8.20/bin/googlesamples-assistant-pushtotalk", line 5, in <module>
    from googlesamples.assistant.grpc.pushtotalk import main
    File "/home/mirror/.pyenv/versions/3.8.20/lib/python3.8/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 27, in <module>
    from google.assistant.embedded.v1alpha1 import embedded_assistant_pb2
    File "/home/mirror/.pyenv/versions/3.8.20/lib/python3.8/site-packages/google/assistant/embedded/v1alpha1/embedded_assistant_pb2.py", line 36, in <module>
    _descriptor.EnumValueDescriptor(
    File "/home/mirror/.pyenv/versions/3.8.20/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 920, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
    TypeError: Descriptors cannot be created directly.
    If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
    If you cannot immediately regenerate your protos, some other possible workarounds are:
    1. Downgrade the protobuf package to 3.20.x or lower.
    2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).


    at this point i ran the following pip uninstall protobuf and pip install protobuf==3.20.0

    Now when trying to run 'googlesamples-assistant-pushtotalk' I get the following error.

    mirror@raspberrypi:~/.pyenv/versions/3.8.20/bin $ /home/mirror/.pyenv/versions/3.8.20/bin/googlesamples-assistant-pushtotalk
    Traceback (most recent call last):
    File "/home/mirror/.pyenv/versions/3.8.20/bin/googlesamples-assistant-pushtotalk", line 5, in <module>
    from googlesamples.assistant.grpc.pushtotalk import main
    File "/home/mirror/.pyenv/versions/3.8.20/lib/python3.8/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 29, in <module>
    from tenacity import retry, stop_after_attempt, retry_if_exception
    File "/home/mirror/.pyenv/versions/3.8.20/lib/python3.8/site-packages/tenacity/__init__.py", line 292
    from tenacity.async import AsyncRetrying
    ^
    SyntaxError: invalid syntax```


    I don't have any ideas on how to proceed. I've spent a good amount of time trying to figure this out on my own and I just do not have the aptitude. If someone could help in any way, I can't put into words how grateful I would be. Thank you for your time.

    Continue reading...

Compartilhe esta Página