KeyError: 'selector' while deploying streamlit python app on Heroku

Hi guys,

I have deployed my python app via streamlit on heroku. The only issue I face is that when I try to display a styled dataframe with background gradient on heroku it throws me the following error:

    KeyError: 'selector'
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/", line 319, in _run_script
    exec(code, module.__dict__)
File "/app/", line 243, in <module>
    print(st.dataframe(etf.format_world_data(world_indices(), usd=usd)[1]))
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/", line 921, in dataframe
    set_data_frame, "dataframe", element_width=width, element_height=height
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/", line 426, in _enqueue_new_element_delta
    rv = marshall_element(
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/", line 918, in set_data_frame
    data_frame_proto.marshall_data_frame(data, delta.data_frame)
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/elements/", line 54, in marshall_data_frame
    _marshall_styles(, df, styler)
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/elements/", line 74, in _marshall_styles
    css_styles = _get_css_styles(translated_style)
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/elements/", line 116, in _get_css_styles
    cell_selector = cell_style["selector"]  # a string of the form 'row0_col0'

The code works fine on my local machine and displays the styled dataframe perfectly. I have tried using st.write, st.dataframe and st.table as well, but still the error when deployed on heroku. What can I do to rectify this?

This question is a duplicate to this SO, where the answer was accepted.