From 2b9210c8e3894b2c9afa86549ab73e2371cbfdc8 Mon Sep 17 00:00:00 2001 From: meg <90473723+meg-huggingface@users.noreply.github.com> Date: Sat, 9 Nov 2024 19:39:59 -0800 Subject: [PATCH] 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 --- CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f502f421823d..6e89720d3b32f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,6 +109,9 @@ if __name__ == "__main__": demo.launch() ``` +Make sure your `PYTHONPATH` includes the directory where this repository is cloned, e.g., +`export PYTHONPATH="./"` + then run: ``` @@ -348,5 +351,18 @@ Run `scripts/build_frontend.sh` with the environment variable `NODE_OPTIONS=--ma --- +In the case of: +- Unexpected Exceptions being thrown; +- The following warning: +`IMPORTANT: You are using gradio version , however version is available, please upgrade.` + +Make sure your `PYTHONPATH` includes the directory where this 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!_