Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name '_make_rich_rext' from 'typer.rich_utils' #259

Closed
fauust opened this issue Nov 27, 2024 · 3 comments
Closed

Comments

@fauust
Copy link

fauust commented Nov 27, 2024

Hi!
I am trying to install and use zabbix-cli but I am probably doing something wrong:

zabbix-cli
Traceback (most recent call last):
  File "/home/faust/.venv/bin/zabbix-cli", line 5, in <module>
    from zabbix_cli.main import main
  File "/home/faust/.venv/lib/python3.12/site-packages/zabbix_cli/__init__.py", line 5, in <module>
    patch_all()
  File "/home/faust/.venv/lib/python3.12/site-packages/zabbix_cli/_patches/__init__.py", line 8, in patch_all
    typer.patch()
  File "/home/faust/.venv/lib/python3.12/site-packages/zabbix_cli/_patches/typer.py", line 314, in patch
    patch_help_text_spacing()
  File "/home/faust/.venv/lib/python3.12/site-packages/zabbix_cli/_patches/typer.py", line 63, in patch_help_text_spacing
    from typer.rich_utils import _make_rich_rext
ImportError: cannot import name '_make_rich_rext' from 'typer.rich_utils' (/home/faust/.venv/lib/python3.12/site-packages/typer/rich_utils.py). Did you mean: '_make_rich_text'?

I am on Alpine Linux 3.20.

I also tested it in various Debian version (11 and 12), same problem, see below:

podman run -it debian:11 bash
root@953854425d06:/# apt update && apt upgrade -y && apt install -y curl
root@953854425d06:/# curl -LsSf https://astral.sh/uv/install.sh | sh
root@953854425d06:/# source $HOME/.local/bin/env
root@953854425d06:/# uv tool install zabbix-cli-uio
root@953854425d06:/# zabbix-cli
Traceback (most recent call last):
  File "/root/.local/bin/zabbix-cli", line 5, in <module>
    from zabbix_cli.main import main
  File "/root/.local/share/uv/tools/zabbix-cli-uio/lib/python3.13/site-packages/zabbix_cli/__init__.py", line 5, in <module>
    patch_all()
    ~~~~~~~~~^^
  File "/root/.local/share/uv/tools/zabbix-cli-uio/lib/python3.13/site-packages/zabbix_cli/_patches/__init__.py", line 8, in patch_all
    typer.patch()
    ~~~~~~~~~~~^^
  File "/root/.local/share/uv/tools/zabbix-cli-uio/lib/python3.13/site-packages/zabbix_cli/_patches/typer.py", line 314, in patch
    patch_help_text_spacing()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/root/.local/share/uv/tools/zabbix-cli-uio/lib/python3.13/site-packages/zabbix_cli/_patches/typer.py", line 63, in patch_help_text_spacing
    from typer.rich_utils import _make_rich_rext
ImportError: cannot import name '_make_rich_rext' from 'typer.rich_utils' (/root/.local/share/uv/tools/zabbix-cli-uio/lib/python3.13/site-packages/typer/rich_utils.py)

What am I doing wrong (or am I hitting a buggy dependency?).

@pederhan
Copy link
Member

pederhan commented Nov 28, 2024

Hm, that is weird. I bumped the minimum Typer requirement to 0.13.1, which changed this internal name (fastapi/typer#959). Somehow I must have forgotten to commit this change before building the newest version. I'll build a new version shortly that fixes this.

I'll also look into adding a compatibility shim and make that more robust (we shouldn't use internal functions from other libraries, but Typer is not very customizable, so we have to use some dirty hacks).

@fauust
Copy link
Author

fauust commented Nov 28, 2024

thanks @pederhan !

@pederhan
Copy link
Member

Fixed in https://github.com/unioslo/zabbix-cli/releases/tag/3.4.0. Thanks for bringing this to my notice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants