2
0
mirror of https://github.com/gradio-app/gradio.git synced 2025-04-12 12:40:29 +08:00

Explain that PYTHONPATH must be updated ()

* Explain that PYTHONPATH must be updated

Cloning this repository, then building & running scripts, can run into the issue of the `import gradio` call pulling `gradio` in from somewhere else (such as the virtual environment). To address this, users need to tell python where to look in order to use the cloned git repo for `gradio`.

Further details in https://huggingface.slack.com/archives/C02SPHC1KD1/p1731207233633159?thread_ts=1731206608.882719&cid=C02SPHC1KD1 for more

* tweaks

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
meg 2024-11-12 12:44:57 -08:00 committed by GitHub
parent a70ba5e0f0
commit 1555321f6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -117,6 +117,9 @@ gradio app.py
This will start the backend server in reload mode, which will watch for changes in the `gradio` folder and reload the app if changes are made. By default, Gradio will launch on port 7860. You can also just use `python app.py`, but this won't automatically trigger updates.
Note: if you have `gradio` installed elsewhere in your system, you may need to uninstall it or at least make sure your `PYTHONPATH` includes the directory where the Gradio repository is cloned, e.g.,
`export PYTHONPATH="./"`
If you're making frontend changes, start the frontend server:
@ -348,5 +351,18 @@ Run `scripts/build_frontend.sh` with the environment variable `NODE_OPTIONS=--ma
---
In the case of:
- Unexpected exceptions being thrown, or
- The following warning:
`IMPORTANT: You are using gradio version <earlier version>, however version <later version> is available, please upgrade.`
ensure your `PYTHONPATH` includes the directory where the Gradio repository is cloned, e.g.:
```export PYTHONPATH="./"```
This ensures that when `gradio` is imported in a python program, it is this current version from this repository.
---
_Could these guidelines be clearer? Feel free to open a PR to help us facilitate open-source contributions!_