HELP: accidentaly upgraded using conda, after reversing streamlit conda env borked!

Summary

PLS HELP TO RESTORE TO LAST WORKING ENV.

Everything was working fine for months , I accidentally upgraded streamlit 1.18.1 using –

$ conda install -c conda-forge streamlit

which i noticed downgraded my streamlit to 1.8.0!
then i remember should’ve used pip

used following to restore conda env (from revision 8 latest to previous 7)

$ conda install --revision 7

seemed to work correctly .

But since conda’s streamlit seemed to have removed streamlit 1.18 had to reinstall streamlit with pip using-

$pip install --upgrade streamlit

seeemd to work fine but now streamlit throwing errors -

$ streamlit hello
Error processing line 1 of /home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/protobuf-3.20.3-nspkg.pth:

  Traceback (most recent call last):
    File "<frozen site>", line 186, in addpackage
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 570, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Traceback (most recent call last):
  File "/home/khan/miniconda3/envs/Twitterbot/bin/streamlit", line 5, in <module>
    from streamlit.web.cli import main
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/__init__.py", line 55, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/delta_generator.py", line 36, in <module>
    from streamlit import config, cursor, env_util, logger, runtime, type_util, util
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/cursor.py", line 18, in <module>
    from streamlit.runtime.scriptrunner import get_script_run_ctx
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/runtime/__init__.py", line 16, in <module>
    from streamlit.runtime.runtime import Runtime as Runtime
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/runtime/runtime.py", line 27, in <module>
    from streamlit.proto.BackMsg_pb2 import BackMsg
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/proto/BackMsg_pb2.py", line 5, in <module>
    from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'

Debug info

  • Streamlit version: 1.19.1
  • Python version: 3.11.0
  • Using Conda!
  • OS version: :Linux Mint 21 5.19.0-35-generic (64-bit)

Hi @Free-Radical :wave:

I’m not an expert on conda, but the error seems to indicate an issue importing Google’s protobuf package. If you’ve installed Streamlit in the conda environment with pip, could you in the same env try installing protobuf?

$ pip install protobuf
$ streamlit hello

or

$ pip install -U protobuf
$ streamlit hello

Let me know if either of those helped :balloon:

Thanks but didnt work

$ pip install -U protobuf
Error processing line 1 of /home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/protobuf-3.20.3-nspkg.pth:

  Traceback (most recent call last):
    File "<frozen site>", line 186, in addpackage
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 570, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Requirement already satisfied: protobuf in /home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages (3.20.3)
Collecting protobuf
  Downloading protobuf-4.22.0-cp37-abi3-manylinux2014_x86_64.whl (302 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 302.4/302.4 kB 3.0 MB/s eta 0:00:00
Installing collected packages: protobuf
  Attempting uninstall: protobuf
    Found existing installation: protobuf 3.20.3
    Uninstalling protobuf-3.20.3:
      Successfully uninstalled protobuf-3.20.3
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.
streamlit 1.19.0 requires protobuf<4,>=3.12, but you have protobuf 4.22.0 which is incompatible.
Successfully installed protobuf-4.22.0

$ streamlit hello
Traceback (most recent call last):
  File "/home/khan/miniconda3/envs/Twitterbot/bin/streamlit", line 5, in <module>
    from streamlit.web.cli import main
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/__init__.py", line 55, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/delta_generator.py", line 36, in <module>
    from streamlit import config, cursor, env_util, logger, runtime, type_util, util
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/cursor.py", line 18, in <module>
    from streamlit.runtime.scriptrunner import get_script_run_ctx
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/runtime/__init__.py", line 16, in <module>
    from streamlit.runtime.runtime import Runtime as Runtime
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/runtime/runtime.py", line 27, in <module>
    from streamlit.proto.BackMsg_pb2 import BackMsg
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/proto/BackMsg_pb2.py", line 14, in <module>
    from streamlit.proto import ClientState_pb2 as streamlit_dot_proto_dot_ClientState__pb2
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/proto/ClientState_pb2.py", line 14, in <module>
    from streamlit.proto import WidgetStates_pb2 as streamlit_dot_proto_dot_WidgetStates__pb2
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/proto/WidgetStates_pb2.py", line 14, in <module>
    from streamlit.proto import Common_pb2 as streamlit_dot_proto_dot_Common__pb2
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/streamlit/proto/Common_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "/home/khan/miniconda3/envs/Twitterbot/lib/python3.11/site-packages/google/protobuf/descriptor.py", line 561, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not 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).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

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