Streamlit_folium is breaking streamlit

I am trying to follow this tutorial:

The python code requires something called streamlit_folium. I used conda to create an environment for streamlit following these instructions:

After creating the environment (python 3.7.12) on my Windows machine and using pip to install streamlit, the “streamlit hello” test worked properly.

Then I used Anaconda to install the packages necessary for the tutorial: pandas, folium, geopandas, streamlit_folium.

After installing these packages to the environment, the “streamlit hello” test no longer works (see error message at end of this post). In fact no command beginning with “streamlit” works.

It seems like the problem is only with streamlit_folium because if I install the other packages but not streamlit _folium then streamlit will still work. But of course then I can’t import streamlit_folium and so my python code won’t run. Does anyone have any ideas how I might fix this?

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\Scripts\", line 5, in <module>
    from streamlit.cli import main
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\", line 70, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\", line 19, in <module>
    from streamlit import cursor, caching
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\", line 18, in <module>
    from streamlit.script_run_context import get_script_run_ctx
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\", line 23, in <module>
    from streamlit.state import SessionState
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\state\", line 25, in <module>
    from .auto_session_state import (
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\state\", line 24, in <module>
    from streamlit.type_util import Key
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\", line 20, in <module>
    from pandas import DataFrame, Series, Index
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pandas\", line 50, in <module>
    from pandas.core.api import (
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pandas\core\", line 29, in <module>
    from pandas.core.arrays import Categorical
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pandas\core\arrays\", line 20, in <module>
    from pandas.core.arrays.string_arrow import ArrowStringArray
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pandas\core\arrays\", line 65, in <module>
    import pyarrow.compute as pc
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pyarrow\", line 18, in <module>
    from pyarrow._compute import (  # noqa
ImportError: DLL load failed: The specified procedure could not be found.

Okay, I’m going to answer my own question.

Upon further experimentation, everything works fine if (instead of using conda) I install streamlit-folium with:

pip install streamlit-folium

Just don’t ask me why!

1 Like