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/, 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/’ 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)

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