admin管理员组

文章数量:1279057

I'm trying to run a script (start.sh) that depends on a Python virtual environment with formant and protobuf. However, I'm encountering an error when importing runtime_version from google.protobuf. I've followed several steps to resolve it, but the issue persists. Below, I provide details about my environment, pre-conditions, actual results, and expected results.

Environment: Operating System: Ubuntu Jellyfish

Python: 3.10

Virtual Environment: mi_entorno (created with python3 -m venv)

Installed Packages:

formant==1.230.2

protobuf==3.19.5 (version compatible with formant)

Pre-Conditions:

  1. I created a virtual environment using python3 -m venv mi_entorno.

  2. I activated the virtual environment: source mi_entorno/bin/activate.

  3. I installed dependencies from a requirements.txt file that includes formant and protobuf.

  4. The requirements.txt file specifies protobuf<=3.19.5,>=3.15.8 as a requirement for formant.

Actual Result: When trying to run the start.sh script, I get the following error:

File "<venv_path>/lib/python3.10/site-packages/formant/protos/agent/v1/agent_pb2.py", line 9, in <module>
    from google.protobuf import runtime_version as _runtime_version
ImportError: cannot import name 'runtime_version' from 'google.protobuf' (<venv_path>/lib/python3.10/site-packages/google/protobuf/__init__.py)

Additionally, when trying to update protobuf, I get a dependency conflict message:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
formant 1.230.2 requires protobuf<=3.19.5,>=3.15.8; python_version >= "3.0.0", but you have protobuf 5.29.3 which is incompatible.

Question: How can I resolve the runtime_version import error from google.protobuf? Is there a way to make formant compatible with a newer version of protobuf, or do I need to modify the code to avoid using runtime_version?

本文标签: