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\streamlit-script.py", line 5, in <module>
    from streamlit.cli import main
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\__init__.py", line 70, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\delta_generator.py", line 19, in <module>
    from streamlit import cursor, caching
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\cursor.py", 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\script_run_context.py", line 23, in <module>
    from streamlit.state import SessionState
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\state\__init__.py", line 25, in <module>
    from .auto_session_state import (
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\state\auto_session_state.py", line 24, in <module>
    from streamlit.type_util import Key
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\streamlit\type_util.py", line 20, in <module>
    from pandas import DataFrame, Series, Index
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pandas\__init__.py", line 50, in <module>
    from pandas.core.api import (
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pandas\core\api.py", line 29, in <module>
    from pandas.core.arrays import Categorical
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pandas\core\arrays\__init__.py", 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\string_arrow.py", line 65, in <module>
    import pyarrow.compute as pc
  File "C:\ProgramData\Anaconda3\envs\streamlit_tutorial\lib\site-packages\pyarrow\compute.py", 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