Streamlit fails due to Seaborn

Hello everyone, a few month ago I built a small app using streamlit.
Today after I didn’t touch the directory for a while I tried running the app again and I’ve got the following error message:

ImportError: dlopen(/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/linalg/_fblas.cpython-310-darwin.so, 0x0002): Library not loaded: ‘/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib’ Referenced from: ‘/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/linalg/_fblas.cpython-310-darwin.so’ Reason: tried: ‘/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib’ (no such file), ‘/usr/local/lib/libgfortran.5.dylib’ (no such file), ‘/usr/lib/libgfortran.5.dylib’ (no such file)
Traceback:

File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/streamlit/scriptrunner/script_runner.py”, line 554, in _run_script
exec(code, module.dict)
File “/Users/yotamhadari/Documents/Python_projects/Research-scripts/st_Q_answers.py”, line 4, in
import seaborn as sns
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/seaborn/init.py”, line 2, in
from .rcmod import * # noqa: F401,F403
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/seaborn/rcmod.py”, line 7, in
from . import palettes
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/seaborn/palettes.py”, line 9, in
from .utils import desaturate, get_color_cycle
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/seaborn/utils.py”, line 10, in
from scipy import stats
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/stats/init.py”, line 453, in
from ._stats_py import *
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/stats/_stats_py.py”, line 38, in
from scipy.spatial.distance import cdist
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/spatial/init.py”, line 107, in
from ._procrustes import procrustes
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/spatial/_procrustes.py”, line 9, in
from scipy.linalg import orthogonal_procrustes
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/linalg/init.py”, line 198, in
from ._misc import *
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/linalg/_misc.py”, line 3, in
from .blas import get_blas_funcs
File “/Users/yotamhadari/.pyenv/versions/3.10.4/lib/python3.10/site-packages/scipy/linalg/blas.py”, line 213, in
from scipy.linalg import _fblas

It seems like some problem with the SEABORN moudle that I use with the st.pyplot function, when I remove the “import seaborn as sns” line the app works but obviously without the seaborn chart that it deploys, I checked the requirements.txt and it is up to date so I wonder if anyone else has this problem and if there is anyway to fix it?

Hi there,

Thanks for sharing your question with the community! Can you share a code snippet/your requirements file so we can reproduce the error?

Caroline :balloon:

Have you tried re-installing seaborn? Worth trying:

pip install --upgrade --force-reinstall seaborn

thx this worked