# Error while initializing ZeroGPU

**URL:** <https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578>\
**Category:** Models\
**Created:** [June 9, 2025, 10:04am UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578 "2025-06-09T10:04:07Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![zjuyyx](https://avatars.discourse-cdn.com/v4/letter/z/f0a364/32.png) [@zjuyyx](https://discuss.huggingface.co/u/zjuyyx)\
**Post date:** [June 9, 2025, 10:04am UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/1 "2025-06-09T10:04:07Z")

</div>

We met a problem when restarting this space.

=== Application stopped (exit code: 1) at 2025-06-09 09:46:03.094740285 UTC ===  
/usr/local/lib/python3.10/site-packages/torch\_geometric/typing.py:101: UserWarning: An issue occurred while importing ‘torch-sparse’. Disabling its usage. Stacktrace:  
Class \_DeviceStringOnly does not have an **init** function defined:  
File “/usr/local/lib/python3.10/site-packages/torch\_sparse/tensor.py”, line 482  
def cpu(self):  
return self.to\_device(device=torch.device(‘cpu’), non\_blocking=False)

```auto

warnings.warn(f"An issue occurred while importing 'torch-sparse'. "

ZeroGPU tensors packing: 0.00B [00:00, ?B/s]
ZeroGPU tensors packing: 0.00B [00:00, ?B/s]
2025-06-09 11:46:32,981 INFO [_client.py:1025 _send_single_request] HTTP Request: POST http://device-api.zero/startup-report?cgroupPath=%2Fkubepods.slice%2Fkubepods-burstable.slice%2Fkubepods-burstable-podcd3b3b52_f5bd_4b51_be47_798a988dd534.slice%2Fcri-containerd-7f113b02cd8cb5a7aeed15939ef5beac08a3b0ae76db8297943910dad9a6fa49.scope&gpuSize=large "HTTP/1.1 409 Conflict"
Traceback (most recent call last):
File "/home/user/app/app.py", line 512, in
demo.launch(share=True)
File "/usr/local/lib/python3.10/site-packages/spaces/zero/gradio.py", line 162, in launch
task(*task_args, **task_kwargs)
File "/usr/local/lib/python3.10/site-packages/spaces/zero/ **init**.py", line 30, in startup
client.startup_report(utils.self_cgroup_device_path(), gpu_size)
File "/usr/local/lib/python3.10/site-packages/spaces/zero/client.py", line 57, in startup_report
raise RuntimeError("Error while initializing ZeroGPU: Unknown")
RuntimeError: Error while initializing ZeroGPU: Unknown
2025-06-09 11:46:33,72 INFO [_client.py:1025 _send_single_request] HTTP Request: GET https://api.gradio.app/pkg-version "HTTP/1.1 200 OK"
=== Application stopped (exit code: 1) at 2025-06-09 09:46:34.369466631 UTC ===

Here is the Space URL: https://huggingface.co/spaces/Zaixi/Pocket-Gen. You can find the app.py file there.
How to fix this error?
Thanks.
```

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 9, 2025, 10:29am UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/2 "2025-06-09T10:29:19Z")

</div>

A 500 error with 🤗 icon usually means that the space is overloaded and has crashed, or there is a temporary problem with the site. I heard that it happened last night as well. Let’s try restarting the space.

In any case, the necessary `requirements.txt` file is missing, so it won’t work…

> **[PocketGen - a Hugging Face Space by John6666](https://huggingface.co/spaces/John6666/PocketGen)**
>
> Discover amazing ML apps made by the community

> **[Zaixi/Pocket-Gen at main](https://huggingface.co/spaces/Zaixi/Pocket-Gen/tree/main)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<div class="post-metadata">

**Author:** ![zjuyyx](https://avatars.discourse-cdn.com/v4/letter/z/f0a364/32.png) [@zjuyyx](https://discuss.huggingface.co/u/zjuyyx)\
**Post date:** [June 9, 2025, 12:13pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/3 "2025-06-09T12:13:22Z")

</div>

Thank you for your reply. Actually, the dependencies have already been installed in dev mode, and the project runs fine initially. However, after some time, the above error appears again, and I have tried many times with the same result.  
I have now uploaded the necessary files to the Space. In dev mode, run the following commands:

text

```auto
pip install -r requirements.txt
pip install AutoDockTools_py3-master.zip
python g.py
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.5.0+cu124.html

```

After these, the project should run successfully.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 9, 2025, 12:17pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/4 "2025-06-09T12:17:54Z")

</div>

I see. It was in Dev mode.😅  
Dev mode is convenient, but it has bugs, such as the latest commit not being reflected. Also, in the case of Zero GPU Spaces, if something other than the `spaces` library touches CUDA first, it almost always crashes.

If there are `.to("cuda")` or `.cuda()` in the library, it’s pretty much a no-go.

Also, Zero GPU Spaces are CPU spaces except for those within the `@spaces.GPU` decorator, so installers that assume a CUDA environment will not work. Prebuilt binaries will probably work, though…  
As a result, there are quite a few libraries that are effectively unusable. For details: [zero-gpu-explorers/README · Discussions](https://huggingface.co/spaces/zero-gpu-explorers/README/discussions)

---

<div class="post-metadata">

**Author:** ![meganariley](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/meganariley/32/56966_2.png) [@meganariley](https://discuss.huggingface.co/u/meganariley)\
**Post date:** [June 10, 2025, 6:36pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/5 "2025-06-10T18:36:00Z")

</div>

Thanks for reporting! We’re taking a look.

---

<div class="post-metadata">

**Author:** ![Pimpcat-AU](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pimpcat-au/32/48989_2.png) [@Pimpcat-AU](https://discuss.huggingface.co/u/Pimpcat-AU)\
**Post date:** [June 10, 2025, 7:27pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/7 "2025-06-10T19:27:58Z")

</div>

#### 1. **Check GPU Availability in Space Settings**

- Many Hugging Face Spaces (especially on free/shared tiers) do **not** provide GPU access by default.
- Go to **Space Settings → Hardware** and confirm if GPU is enabled. If not, enable GPU or switch to a paid tier that allows GPU usage.

#### 2. **Fix torch-sparse Version Issues**

- The error indicates a compatibility problem with `torch-sparse`.
- Try upgrading (or downgrading) `torch-sparse` to a version matching your PyTorch version:

```auto
pip install --upgrade torch-sparse

```

or, if using PyTorch 2.x:

```auto
pip install torch-sparse==latest_compatible_version

```

- Also, ensure all dependencies are compatible in your `requirements.txt`.

#### 3. **Force CPU if GPU Unavailable**

- If your Space will not be allocated a GPU, ensure your code has a fallback to CPU. Example:

```python
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tensor = tensor.to(device)

```

- Remove any code that hard-requires a GPU if running on a CPU-only environment.

#### 4. **Restart and Rebuild the Space**

- After making changes, use the **“Restart”** and **“Rebuild”** options in your Space’s management panel.

_Solution provided by Triskel Data Deterministic Ai._

---

<div class="post-metadata">

**Author:** ![eitelk](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/eitelk/32/49534_2.png) [@eitelk](https://discuss.huggingface.co/u/eitelk)\
**Post date:** [July 29, 2025, 4:22pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/8 "2025-07-29T16:22:03Z")

</div>

Hi community,  
about 2 months ago I bought a Hugging Face Pro-subscription plan and set up 4 different Spaces (which I partly generated with the duplicate space button in hugging face). I built and started these spaces with ZeroGPU hardware. Everything worked just perfectly fine.

Then I didn’t use my spaces for about 3 weeks. Today I wanted to restart them but every space I try to start with ZeroGPU just aborts with a strange error 😟 :

> runtime error  
> Exit code: ?. Reason:

I haven’t used any quota for this month as the following picture shows, so this should not be the cause:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/c/7/c7165e631e350a38c3b2f26dc6a636638f4bb2cd.png)

This error doesn’t appear when using “CPU basic” as hardware for the space.

Even when I create a completely new space, activate ZeroGPU in the app.py file (import spaces and @spaces.GPU) the same error appears. To me it doesn’t seem to be of any coding mistake.

What has happened? How can I reactivate ZeroGPU? Where can I get more detailed log information (I can not find more logging infos on the webspace)? 🤔

Any help is highly appreaciated! 🙏 Thank’s a lot! 🩷  
Tricia

---

<div class="post-metadata">

**Author:** ![saptarshineilsinha](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/saptarshineilsinha/32/51857_2.png) [@saptarshineilsinha](https://discuss.huggingface.co/u/saptarshineilsinha)\
**Post date:** [July 29, 2025, 5:01pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/9 "2025-07-29T17:01:24Z")

</div>

I also have the same issue

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [July 29, 2025, 9:58pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/10 "2025-07-29T21:58:21Z")

</div>

The issue `saptarshineilsinha` is experiencing [seems to be able temporarily workarounded by this change](https://discuss.huggingface.co/t/on-restart-zerogpu-not-working-but-on-cpu-it-works/164979/2). But weird. Perhaps there was a change in how example cache is handled on the server side yesterday or so…? @hysts

---

<div class="post-metadata">

**Author:** ![eitelk](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/eitelk/32/49534_2.png) [@eitelk](https://discuss.huggingface.co/u/eitelk)\
**Post date:** [July 30, 2025, 10:00am UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/11 "2025-07-30T10:00:15Z")

</div>

For no reason all my spaces are working again with ZeroGPU. 😍 I don’t know what Hugging Face has changed. Hope it stays like this.

Thanks to all involved in solving the problem. And also thanks to you @John6666 and @saptarshineilsinha for your responses.

🩷 Tricia

---

<div class="post-metadata">

**Author:** ![saptarshineilsinha](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/saptarshineilsinha/32/51857_2.png) [@saptarshineilsinha](https://discuss.huggingface.co/u/saptarshineilsinha)\
**Post date:** [July 30, 2025, 11:32am UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/12 "2025-07-30T11:32:04Z")

</div>

Thanks spaces are working again for me

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [July 30, 2025, 12:10pm UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/13 "2025-07-30T12:10:19Z")

</div>

A similar issue was reported on HF Discord at around the same time yesterday. It was probably a temporary problem affecting HF Spaces as a whole.

---

<div class="post-metadata">

**Author:** ![hysts](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hysts/32/32230_2.png) [@hysts](https://discuss.huggingface.co/u/hysts)\
**Post date:** [August 10, 2025, 5:42am UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/14 "2025-08-10T05:42:03Z")

</div>

Sorry, I just noticed that I missed the message.

> Perhaps there was a change in how example cache is handled on the server side yesterday or so…?

I don’t think we’ve changed anything about it.

> A similar issue was reported on HF Discord at around the same time yesterday. It was probably a temporary problem affecting HF Spaces as a whole.

Yeah, I think that was the case. Sometimes backend clusters might go down, for example, due to DDoS.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [August 10, 2025, 6:20am UTC](https://discuss.huggingface.co/t/error-while-initializing-zerogpu/158578/15 "2025-08-10T06:20:47Z")

</div>

Thank you!

I see. Since there have been no further reports of the same problem, it’s probably fine now.  
Cache-related issues are prone to bugs, so it’s difficult to distinguish between bugs and glitches.😅
