Can't get the space to run

#251
by randybaskins - opened

Before even editing app.py, I can't get the duplicated space to run. I just get a bunch errors like the following:

File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 998, in
desc = " | ".join([json_schema_to_python_type(i, defs) for i in schema[type]])
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 946, in _json_schema_to_python_type
return _json_schema_to_python_type(defs[schema["$ref"].split("/")[-1]], defs)
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 985, in _json_schema_to_python_type
des = [
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 986, in
f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 946, in _json_schema_to_python_type
return _json_schema_to_python_type(defs[schema["$ref"].split("/")[-1]], defs)
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 985, in _json_schema_to_python_type
des = [
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 986, in
f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 993, in _json_schema_to_python_type
f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 939, in json_schema_to_python_type
type
= get_type(schema)
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 898, in get_type
if "const" in schema:
TypeError: argument of type 'bool' is not iterable

Any ideas?

I am also facing the same problem and unable to submit any thing in chat UI

Same here. This seems to be a problem caused in Gradio. Maybe there was a change in the gradio library which came into the application by importing the newest version and is not reflected in Gradio UI definition of our app. But do not speak Python fluently yet so this is just guessing.

Anyhow here is my space in case someone from the agents course team would like to take a lookat the logs.

https://huggingface.co/spaces/marksml/First_agent_template/blob/main/app.py?logs=container

It says there

"....
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 986, in
| f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
| File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 946, in _json_schema_to_python_type
| return _json_schema_to_python_type(defs[schema["$ref"].split("/")[-1]], defs)
| File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 985, in _json_schema_to_python_type
| des = [
| File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 986, in
| f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
| File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 993, in _json_schema_to_python_type
| f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
| File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 939, in json_schema_to_python_type
| type
= get_type(schema)
| File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 898, in get_type
| if "const" in schema:
| TypeError: argument of type 'bool' is not iterable
....
"

One more observation:
I can run the app.py locally on python 3.13 without any issues. The docker image is using python 3.10.
Maybe there is an problem there.

2025-03-29 09_58_06-Gradio.png

same here, any solution?

same here, as part of the HF Agent Course...

I am also facing this same issue.

image.png

Same here, wont even let me send the message in my duplicated space. I tried the main one which let me send the message but gave lots of error which is odd

image.png

very annoying. please give a runnable code if you want to publish a course.

To fix the issue Upgrade gradio SDK in README.md, either by editing the file or by clicking the Upgrade button in the top right corner

image.png

Cheers!

@Taxiarchis Thanks -- Updated in Repo and worked

@Taxiarchis Hey Taxiarchis, that is a very strange config setup. Should we not get the same configuration in the running container when we clone a space? Any idea or hint where gradio lib is configured and bound to?

Thank you very much indeed for providing some insights in the inner workings of HF spaces.

For the course there should be a hint to upgrade the gradio version right after the cloning part.

Cheers Michael

Good querstion @marksml . In the Build phase logs (If you factory rebuild your image in the setting), you can see the docker commands executed for each docker layer. The requirements installation command ( RUN --mount=target=/tmp/requirements.txt,source=requirements.txt pip install --no-cache-dir -r /tmp/requirements.txt layer command is before the RUN pip install --no-cache-dir gradio[oauth]==5.23.1 "uvicorn>=0.14.0" spacesz which basically overwrites any predefined gradio installation (I tried first to add the gradio version in the requirements and it was still failing). From my point of view, the second command is not necessary if you want create your own docker image locally, just add gradio[oauth]==5.23.1 in the requirements file.

With regards to your question on how the HF spaces work/setup, I guess their documentation could maybe give more info https://huggingface.co/docs/hub/en/spaces-overview and https://huggingface.co/docs/hub/en/spaces-sdks-docker

image.png

image.png

Cheers!

updated and worked. thanks

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment