Python で Web アプリケーションを簡単に作成できるフレームワーク「Streamlit」の実行時にエラーに遭遇したので、同じエラーで悩んでる方の参考になれば幸いです。
Streamlit • A faster way to build and share data apps
Streamlit is an open-source Python framework for data scientists and AI/ML engineers to deliver interactive data apps – in only a few lines of code.
目次
現象
streamlit run
コマンドを実行するとエラーになる。
ImportError でエラーメッセージは「symbol not found in flat namespace」
ImportError: dlopen(/Users/---途中のパスは省略/lib/python3.10/site-packages/google/protobuf/pyext/_message.cpython-310-darwin.so, 0x0002):
環境
- Mac mini (M1, 2020)
- MacOS Monterey バージョン 12.6
- Python 3.10.6 (pyenv でインストール)
- Pipenv で仮想環境を作成
- Streamlit 1.13.0
回避策
Streamlit をインストールすると「protobuf」というパッケージもインストールされていますが、protobuf のバージョンを 3.20.3 から 3.20.1 にバージョンダウンしてあげると、このエラーを回避できます。
pip install protobuf==3.20.1
おわりに
今回は、
Streamlit を実行すると symbol not found in flat namespace というエラーになってしまう時の回避方法
をご紹介しました。
以上です。
コメント