can not run a python file using pipx and gradio_client

I want to try an API on huggingface.co I need to do:
pip install gradio_client
but with debian, I need to use pipx. So I do:
pipx install gradio_client --include-deps
then, I have a file classification.py which begins with:
from gradio_client import Client
and when I do:
pipx run classification.py
I have an error:
ModuleNotFoundError: No module named 'gradio_client'
I don't know if the error comes from my pipx command or from gradio. Last information, when I do:
pipx list
I get:
venvs are in /home/tibo/.local/share/pipx/venvs
apps are exposed on your $PATH at /home/tibo/.local/bin
manual pages are exposed at /home/tibo/.local/share/man
package gradio 5.27.0, installed using Python 3.13.2
- gradio
- upload_theme
package gradio-client 1.9.0, installed using Python 3.13.2
- httpx
- huggingface-cli
- normalizer
- tqdm
- websockets
How to run my classification.py?
Answer
I don't know why you think that you have to use pipx
on Debian.
I use pip
on Linux Mint which is based on Ubuntu which is based on Debian.
As I know pipx
is rather for running already existing programs,
but rather not when you want to create new code.
Better install with pip
and eventually use python -m venv
to create virtual environment for your project.
Or you can try tool Read more
If you already use pipx
for own code then don't use pipx run
but you have to activate venv before runing code with normal command python
source ~/.local/share/pipx/venvs/gradio-client/bin/activate
python classification.py
deactivate
or you may run directly python in venv without activation
~/.local/share/pipx/venvs/gradio-client/bin/python classification.py
(at least it works for me on Linux Mint)
Text from pipx page
`pipx run` downloads and runs the above mentioned Python "apps" in a one-time,
temporary environment, leaving your system untouched afterwards.
and it explains why it doesn't work for you - because it creates new (temporary) venv without module gradio_client
Enjoyed this article?
Check out more content on our blog or follow us on social media.
Browse more articles