Pytest returning KeyError: 'Unknown descriptor pool'

:wave: Hello! My pytest is returning the above mentioned error when I ran pytest on my project after installing streamlit!

Here is the full error log that Pytest returned:

============================= test session starts ==============================
platform linux -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/runner/work/half-hourly-forecasting/half-hourly-forecasting
plugins: anyio-3.6.1
collected 18 items / 1 error
==================================== ERRORS ====================================
___________ ERROR collecting streamlitapp/tests/test_streamlitapp.py ___________
streamlitapp/tests/test_streamlitapp.py:3: in <module>
    from streamlitapp.streamlitapp import map_selection_to_archetype
streamlitapp/streamlitapp.py:3: in <module>
    import streamlit as st
../../../.local/share/virtualenvs/half-hourly-forecasting-_x0FZkRt/lib/python3.9/site-packages/streamlit/__init__.py:48: in <module>
    from streamlit.proto.RootContainer_pb2 import RootContainer
../../../.local/share/virtualenvs/half-hourly-forecasting-_x0FZkRt/lib/python3.9/site-packages/streamlit/proto/RootContainer_pb2.py:17: in <module>
    DESCRIPTOR = _descriptor.FileDescriptor(
../../../.local/share/virtualenvs/half-hourly-forecasting-_x0FZkRt/lib/python3.9/site-packages/google/protobuf/descriptor.py:1024: in __new__
    return _message.default_pool.AddSerializedFile(serialized_pb)
E   KeyError: 'Unknown descriptor pool'

Has anyone seen similar error before and how might I fix this please? :pray:

It seems like there might be some conflict with protobuf?

I’m running streamlit====1.10.0.

I think I’ve solved it by pinning protobuf to ==3.19.4. Streamlit has protobuf pinned to >=3.19.4, <4 but that’s too relaxed - I think there are some breaking changes with protobuf>=3.20!

1 Like

The protobuf issue was fixed in the latest versions of streamlit, you are using a quite old version of streamlit.

Hmmm I’m pretty sure 1.10.0 is the latest version? Or the latest one according to pypi…

Am I missing something?

Sorry, you’re right, I was looking too superficially… :innocent:

Nevertheless, the problem with protobuf should actually be fixed in the latest versions of Streamlit. :thinking:

Issue with Protocol Buffers - #5 by randyzwitch

Just to add that I’m using an M1 mac - so I feel like it could just be an M1 mac thing…

Thanks, it worked for me too! :slight_smile:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.