Zsh: segmentation fault with Streamlit

I followed the instructions here (Install Streamlit using command line - Streamlit Docs) & created a venv, installed streamlit, and tested the installation by running the streamlit hello example.

However, it exits abruptly with a zsh: segmentation fault.

Stack trace:

 Welcome to Streamlit. Check out our demo in your browser.

  Local URL: http://localhost:8501
  Network URL: http://10.0.0.29:8501

  Ready to create your own Python apps super quickly?
  Head over to https://docs.streamlit.io

  May you create awesome apps!


  For better performance, install the Watchdog module:

  $ xcode-select --install
  $ pip install watchdog
            
zsh: segmentation fault  streamlit hello

I noticed this happening especially when I navigate to other pages - Plotting Demo/Mapping Demo pages for example.
Streamlit version: 1.37.0
MacOS: Big Sur, 11.6

I have an earlier streamlit project from few months back which is in a different folder. That one still seems to be executing fine. Streamlit version: 1.31.1

Any pointers on how to resolve this? Would you recommend installing an earlier version of streamlit?
All these projects are running locally.

I am having the same issue on local appplications. I have tried multiple applications running version from 1.22.0 to 1.37.0 and I get “zsh: segmentation fault” on all attempts to run a streamlit application. The only application that works is ‘streamlit hello’ but that only works on 1.37.0. With the exception of “streamlit hello”, most version immediately terminate, while 1.37.0 will appear to connect but then show the "zsh: segmentation fault " after roughly 20 seconds of trying to connect.

I have destroyed and recreated environments nearly a dozen times (no exaggeration), restarted the machine. I am using conda virtual environments.

I went through the forums looking for answers and found 3 others on Big Sur who are experiencing the same segmentation fault problem, so this is unlikely a coincidence.

macOS Big Sur 11.5.2
Streamlit version 1.37.0

I am having the same issue "zsh: segmentation fault streamlit run… " I am using pipenv virtual environment. This is also on an older - (OK Ancient mid 2014 MBP) running Big Sur 11.7.10 at work. I run the same code on my home MBP M1 and it runs fine. My guess is the last update broke something on this old machine.

I am having the same issue - running Python 3.11 on an old Mac Mini running Catalina 10.15.7. I just set up a brand new environment and am running streamlit version 1.38.0.

I tested with Python 3.9 and 3.12 as well as testing with the previous poster’s streamlit version 1.31.1 and all of these combinations segfault as well, as soon as the page is loaded.

I can get the page to load with just streamlit, but then it misses matplotlib. When I install matplotlib, I then get the segfault.

Here’s the output with faulthandler enabled:

Fatal Python error: Segmentation fault

Current thread 0x0000700012880000 (most recent call first):
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1173 in create_module
  File "<frozen importlib._bootstrap>", line 565 in module_from_spec
  File "<frozen importlib._bootstrap>", line 666 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/pyarrow/__init__.py", line 65 in <module>
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 850 in exec_module
  File "<frozen importlib._bootstrap>", line 680 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/pandas/compat/pyarrow.py", line 8 in <module>
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 850 in exec_module
  File "<frozen importlib._bootstrap>", line 680 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/pandas/compat/__init__.py", line 27 in <module>
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 850 in exec_module
  File "<frozen importlib._bootstrap>", line 680 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/pandas/__init__.py", line 26 in <module>
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 850 in exec_module
  File "<frozen importlib._bootstrap>", line 680 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/Users/client/src/aspen/docs/risk_report_app.py", line 12 in <module>
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 590 in code_to_exec
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88 in exec_func_with_error_handling
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 606 in _run_script
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 320 in _run_script_thread
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 917 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 980 in _bootstrap_inner
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 937 in _bootstrap

Thread 0x000070001187d000 (most recent call first):
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/watcher/polling_path_watcher.py", line 85 in task
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 58 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 83 in _worker
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 917 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 980 in _bootstrap_inner
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 937 in _bootstrap

Thread 0x000070001087a000 (most recent call first):
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/watcher/polling_path_watcher.py", line 85 in task
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 58 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 83 in _worker
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 917 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 980 in _bootstrap_inner
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 937 in _bootstrap

Thread 0x000070000f771000 (most recent call first):
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/watcher/polling_path_watcher.py", line 85 in task
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 58 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 83 in _worker
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 917 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 980 in _bootstrap_inner
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 937 in _bootstrap

Thread 0x000070000e76e000 (most recent call first):
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/watcher/polling_path_watcher.py", line 85 in task
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 58 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/concurrent/futures/thread.py", line 83 in _worker
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 917 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 980 in _bootstrap_inner
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/threading.py", line 937 in _bootstrap

Thread 0x0000000108b84dc0 (most recent call first):
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/selectors.py", line 562 in select
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/asyncio/base_events.py", line 1869 in _run_once
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/asyncio/base_events.py", line 601 in run_forever
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/asyncio/base_events.py", line 634 in run_until_complete
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/asyncio/runners.py", line 44 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/web/bootstrap.py", line 326 in run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/web/cli.py", line 274 in _main_run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/streamlit/web/cli.py", line 238 in main_run
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/click/core.py", line 783 in invoke
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/click/core.py", line 1434 in invoke
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/click/core.py", line 1688 in invoke
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/click/core.py", line 1078 in main
  File "/Users/client/micromamba/envs/aspen_test/lib/python3.9/site-packages/click/core.py", line 1157 in __call__
  File "/Users/client/micromamba/envs/aspen_test/bin/streamlit", line 8 in <module>
zsh: segmentation fault  streamlit run risk_report_app.py

A reboot of the machine seems to have fixed this somehow.

I also installed streamlit from the micromamba environment creation command directly, i.e.:

micromamba env create -n myenv python=3.11 streamlit