Home > database >  Why does the simplest streamlit example errors out?
Why does the simplest streamlit example errors out?

Time:03-29

I have the simplest streamlit program

# import module
import streamlit as st

# Title
st.title("Hello GeeksForGeeks !!!")

When I run the code using

streamlit run main.py, I get the following errors:

    SDRRAZAVIPOUR-MAC:[~/PycharmProjects/tool]$ streamlit run main.py
Traceback (most recent call last):
  File "/opt/miniconda3/envs/tool/bin/streamlit", line 8, in <module>
    sys.exit(main())
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/streamlit/cli.py", line 204, in main_run
    _main_run(target, args, flag_options=kwargs)
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/streamlit/cli.py", line 232, in _main_run
    command_line = _get_command_line_as_string()
  File "/opt/miniconda3/envs/tool/lib/python3.10/site-packages/streamlit/cli.py", line 221, in _get_command_line_as_string
    cmd_line_as_list.extend(click.get_os_args())
AttributeError: module 'click' has no attribute 'get_os_args'

What am I missing?

CodePudding user response:

Just ran into the same problem. Seems to be related to the most recent version of the click package.

If you uninstall click:

pip uninstall click

and then install the version before the most recent one:

pip install click==8.0.4

it should work again.

CodePudding user response:

Roll back the version of the click package. When I re-cloned our repo and installed the dependencies, it updated click to 8.1.0 and everything died. I uninstalled it, reinstalled 8.0.4, and it ran fine. Check your version of click. Apparently, the get_os_args function has been removed and is not working with streamlit.

  • Related