Streamlit APP worked before and now crash -- import tensorflow

The app worked before perfectly and one day without any changes from my side, the app crash with this message (above other warning messages you can find below)

W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘libcudart.so.11.0’; dlerror:

Do you have any idea on how to solve it ?

the code of the API in on my github :

Many thanks,

2023-12-13 08:02:41.403512: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2023-12-13 08:02:41.403567: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-12-13 08:02:41.501 Uncaught app exception
Traceback (most recent call last):
  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
    exec(code, module.__dict__)
  File "/mount/src/radiotherapy_quality_control_api/API_CQ_patient_predictor.py", line 7, in <module>
    import tensorflow as tf
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/python/__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/python/eager/context.py", line 29, in <module>
    from tensorflow.core.framework import function_pb2
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/core/framework/function_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
  File "/home/adminuser/venv/lib/python3.9/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "/home/adminuser/venv/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 553, 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).

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

Hey @AurelienCD,

Thanks for sharing this question. Have you tried the suggestion in the error message?

 1. Downgrade the protobuf package to 3.20.x or lower.

Thank you for your answer,

I don’t even know what is protobuf package and I don’t use it

So I addeed in the requirement file :
protobuf==3.9.2
but it doesn’t work, same message saying that I have to downgrade to <3.20 (which 3.9.2 is…)
I saw this post :

So I tried protobuf~=3.19.0
But same message, it seems that it doesn’t want to install this version…
This is so annoying to have to go back to working API and past severa hours to understand why it doesn’t work…

Ok,
I saw this post:

and this github:

So I changed in the requirement as this (with streamlit1.13, tensorflow2.10 and anything about protobuf):

It seems that using tensorflow 2.8 crash because of protobuf but not with tensorflow 2.10 even if I still have the message error saying that I have to downgrade protobuf !!
Good luck everyone

1 Like

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