Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf failure when using Streamlit #19607

Closed
AronsonDan opened this issue Aug 15, 2023 · 5 comments
Closed

Protobuf failure when using Streamlit #19607

AronsonDan opened this issue Aug 15, 2023 · 5 comments
Labels
backend: Python Python backend-related issues bug

Comments

@AronsonDan
Copy link

Describe the bug
When trying to run pants test ::, i have a test that uses streamlit.
While importing streamlit, im getting the following error:

    import streamlit as st
/Users/danaronson/.cache/pants/named_caches/pex_root/venvs/s/d77156b5/venv/lib/python3.9/site-packages/streamlit/__init__.py:48: in <module>
    from streamlit.proto.RootContainer_pb2 import RootContainer
/Users/danaronson/.cache/pants/named_caches/pex_root/venvs/s/d77156b5/venv/lib/python3.9/site-packages/streamlit/proto/RootContainer_pb2.py:33: in <module>
    _descriptor.EnumValueDescriptor(
/Users/danaronson/.cache/pants/named_caches/pex_root/venvs/s/d77156b5/venv/lib/python3.9/site-packages/google/protobuf/descriptor.py:796: in __new__
    _message.Message._CheckCalledFromGeneratedFile()
E   TypeError: Descriptors cannot not be created directly.
E   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.
E   If you cannot immediately regenerate your protos, some other possible workarounds are:
E    1. Downgrade the protobuf package to 3.20.x or lower.
E    2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
E   
E   More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

While using the same code and running the tests using Pytest it is running as expected.

Pants version
pants_version = "2.16.0"

OS
MacOs ventura version: 13.2.1

Additional info
Poetry versions:
python = "3.9.*"
streamlit = "1.8.0"
streamlit-aggrid = "0.2.3"
protobuf = ">=4.21.1,<=4.21.12"

@AronsonDan AronsonDan added the bug label Aug 15, 2023
@WorkerPants
Copy link
Member

Welcome to the Pantsbuild Community. This looks like your first issue here. Thanks for taking the time to write it.

If you haven't already, feel free to come say hi on Slack.

If you have questions, or just want to surface this issue, check out the #development channel.
(If you want to check it out without logging in, check out our Linen mirror)

Thanks again, and we look forward to your next Issue/PR 😄!

@benjyw
Copy link
Contributor

benjyw commented Aug 15, 2023

Hi, can you link to a small repo that reproduces this problem?

@AronsonDan
Copy link
Author

Hi, can you link to a small repo that reproduces this problem?

Hey @benjyw

The issue was resolved using poetry upgrades etc...
What was weird and I will try to reproduce is the fact that the current configuration was failing using Pants and succeeded using Poetry

@benjyw
Copy link
Contributor

benjyw commented Aug 15, 2023

That's odd to me, since Pants doesn't use Poetry at all. So I'm not sure how poetry upgrades would affect any of this. If you're able to reproduce that would be extremely valuable. Thanks!

@huonw huonw added the backend: Python Python backend-related issues label Aug 16, 2023
@AronsonDan
Copy link
Author

What I meant was the following:

  • The source root had a pyproject.toml file
  • the BUILD file contained a poetry_requirements section as a dependency
  • I changed and updated the versions of the python packages
    That succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Python Python backend-related issues bug
Projects
None yet
Development

No branches or pull requests

4 participants