AttributeError: module 'click' has no attribute 'get_os_args'

I started getting this error on all my apps today. Anyone else getting this?

Traceback (most recent call last):

  File "/home/appuser/venv/bin/streamlit", line 8, in <module>

    sys.exit(main())

  File "/home/appuser/venv/lib/python3.7/site-packages/click/core.py", line 1130, in __call__

    return self.main(*args, **kwargs)

  File "/home/appuser/venv/lib/python3.7/site-packages/click/core.py", line 1055, in main

    rv = self.invoke(ctx)

  File "/home/appuser/venv/lib/python3.7/site-packages/click/core.py", line 1657, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/home/appuser/venv/lib/python3.7/site-packages/click/core.py", line 1404, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/home/appuser/venv/lib/python3.7/site-packages/click/core.py", line 760, in invoke

    return __callback(*args, **kwargs)

  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/cli.py", line 204, in main_run

    _main_run(target, args, flag_options=kwargs)

  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/cli.py", line 232, in _main_run

    command_line = _get_command_line_as_string()

  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/cli.py", line 221, in _get_command_line_as_string

    cmd_line_as_list.extend(click.get_os_args())
5 Likes

Same error for me. App was working previously.

I think the reason is the removal of previously deprecated labeled code in the api of the click library version 8.1.0, which was introduced today:

Changes — Click Documentation (8.1.x)

That is the reason this issue appears since today.
The click library is a dependency of streamlit, maybe the issue can be resolved by explicitly nailing the click version in requirements.txt to the previous version:

click<=8.0.4

Dependency hell… :grin:

There is already a github issue:

3 Likes

Tried that already. Doesn’t work. click==8.0.4 is installed and still fails. Perhaps some other dependency?

For now, click==7.1.2 works with existing streamlit package.

2 Likes

click==8.0.3 and click==8.0.1 do not work.

It works now. Thanks man

I updated my repo’s requirements.txt file with

click==8

and it works now

I cannot reproduce this behaviour.
My streamlit cloud app seems to work with

click==8.0.4

which makes sense, because the removal of the deprecated code, that caused the issue, was done in the next version 8.1.0 of click.

1 Like

click==8.0 works for me!
Thanks a lot.

streamlit>=1.8.1

should do the trick, no need for nailing click version anymore

2 Likes

Sorry, but how is this a solution?!

Latest version from -c conda-forge is 1.8.0.

Sorry, but this is one of the reasons i don’t use conda :wink:

Most certainly not:

https://anaconda.org/conda-forge/streamlit

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.