Spaces:
Runtime error
How to solve a `403 Client Error`?
I have cloned the repo successfully and pickle file is generated successfully too, but still got this error.
Any idea of how to solve it? Thanks!
Running on local URL: http://0.0.0.0:7860
To create a public link, set `share=True` in `launch()`.
***********INSIDE CREATE SEARCH INDEX***************
Cloning into '.'...
***********INSIDE DRIVER***************
***********INSIDE CREATE SPACE***************
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py", line 264, in hf_raise_for_status
response.raise_for_status()
File "/home/user/.local/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/api/repos/create
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/gradio/routes.py", line 289, in run_predict
output = await app.blocks.process_api(
File "/home/user/.local/lib/python3.8/site-packages/gradio/blocks.py", line 991, in process_api
result = await self.call_function(fn_index, inputs, iterator)
File "/home/user/.local/lib/python3.8/site-packages/gradio/blocks.py", line 833, in call_function
prediction = await anyio.to_thread.run_sync(
File "/home/user/.local/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/home/user/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/home/user/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "app.py", line 133, in driver
create_space(repo_link, hf_token)
File "app.py", line 54, in create_space
repo_url = api.create_repo(
File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 124, in _inner_fn
return fn(*args, **kwargs)
File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/hf_api.py", line 2010, in create_repo
hf_raise_for_status(r)
File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py", line 318, in hf_raise_for_status
raise HfHubHTTPError(str(e), response=response) from e
huggingface_hub.utils._errors.HfHubHTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/api/repos/create (Request ID: Root=1-63df9ad8-600e75a266385a1a03469582)
You don't have the rights to create a space under this namespace
This could mean that the hf_token that you provided is either incorrect or has read access only. Make sure your hf_token has write access too.
Let me know if this doesn't solve it for you.
i have encountered the same problem. i also changed my key into write access yet error still occurs. what to do?
i have the same problem trying to create a repo under my namespace in huggingface from Google Colab. My hub_token has write access according to the log output. No idea why huggingface api still throws the 403: Forbidden error. How can we know the value of the token used in the create_repo function ? Can someone help ?
It turned out that with the later versions of the transformers libraries, it is not enough if you login to huggingface with a valid write token, but you have to pass it as part of TrainingArguments(…) as follows: args = TrainingArguments(…, hub_token=,…) and pass this args when you invoke the SFTTrainer.
For transformers library version 0.44.2, this worked for me.
In my case - write permissions were 100% there. Nothing helped.
what solved the issue is to give "token=..." parameter to each operation, such as create repo / upload_files. Only that helped.