# How to debug Spaces on hf.co

**URL:** <https://discuss.huggingface.co/t/how-to-debug-spaces-on-hf-co/13191>\
**Category:** Spaces\
**Created:** [December 29, 2021, 3:57am UTC](https://discuss.huggingface.co/t/how-to-debug-spaces-on-hf-co/13191 "2021-12-29T03:57:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pszemraj](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pszemraj/32/17720_2.png) [@pszemraj](https://discuss.huggingface.co/u/pszemraj)\
**Post date:** [December 29, 2021, 3:57am UTC](https://discuss.huggingface.co/t/how-to-debug-spaces-on-hf-co/13191/1 "2021-12-29T03:57:15Z")

</div>

I have a model/app deployment that works perfectly on my local machine and errors out after 1-2 seconds upon pressing “submit” on the hosted Gradio app. Where can I check a log of what is going on? I have no clue… and the documentation for spaces seems incomplete, at least from what I found.

---

<div class="post-metadata">

**Author:** ![merve](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/merve/32/49809_2.png) [@merve](https://discuss.huggingface.co/u/merve)\
**Post date:** [December 29, 2021, 6:48am UTC](https://discuss.huggingface.co/t/how-to-debug-spaces-on-hf-co/13191/2 "2021-12-29T06:48:49Z")

</div>

Hello @pszemraj 🤗  
Can you send me the link to your Space?  
If you’re using it with gradio try setting `debug = True` when launching (one thing I can think of).

---

<div class="post-metadata">

**Author:** ![osanseviero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osanseviero/32/38738_2.png) [@osanseviero](https://discuss.huggingface.co/u/osanseviero)\
**Post date:** [December 29, 2021, 9:15am UTC](https://discuss.huggingface.co/t/how-to-debug-spaces-on-hf-co/13191/3 "2021-12-29T09:15:57Z")

</div>

As @merve mentioned, setting `debug=True` is a good idea. On top of that, once you see the fail message, you can click in “Running” or “Build error” next to the like count, and that will actually show you the logs. FYI we have an internal PR to make this a clear button.

Eg, for your space, I see the following error

> During handling of the above exception, another exception occurred:  
> Traceback (most recent call last):  
> File “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 84, in \_\_load  
> root = nltk.data.find(f"{self.subdir}/{zip\_name}")  
> File “/home/user/.local/lib/python3.8/site-packages/nltk/data.py”, line 583, in find  
> raise LookupError(resource\_not\_found)  
> LookupError:
> 
> * * *
> 
> Resource e[93mstopwordse[0m not found.  
> Please use the NLTK Downloader to obtain the resource:
> 
> e[31m\>\>\> import nltk
> 
> > > > nltk.download(‘stopwords’)  
> > > > e[0m  
> > > > For more information see: [NLTK :: Installing NLTK Data](https://www.nltk.org/data.html)
> 
> Attempted to load e[93mcorpora/stopwords.zip/stopwords/e[0m
> 
> Searched in:  
> - ‘/home/user/nltk\_data’  
> - ‘/usr/local/nltk\_data’  
> - ‘/usr/local/share/nltk\_data’  
> - ‘/usr/local/lib/nltk\_data’  
> - ‘/usr/share/nltk\_data’  
> - ‘/usr/local/share/nltk\_data’  
> - ‘/usr/lib/nltk\_data’  
> - ‘/usr/local/lib/nltk\_data’
> 
> * * *
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):  
> File “/home/user/.local/lib/python3.8/site-packages/gradio/networking.py”, line 196, in predict  
> prediction, durations = app.interface.process(raw\_input)  
> File “/home/user/.local/lib/python3.8/site-packages/gradio/interface.py”, line 373, in process  
> predictions, durations = self.run\_prediction(  
> File “/home/user/.local/lib/python3.8/site-packages/gradio/interface.py”, line 339, in run\_prediction  
> prediction = predict\_fn(\*processed\_input)  
> File “app.py”, line 86, in chat  
> response = ask\_gpt(message)  
> File “app.py”, line 57, in ask\_gpt  
> prompt = clean(message) # clean user input  
> File “/home/user/.local/lib/python3.8/site-packages/cleantext/cleantext.py”, line 8, in clean  
> stop\_words = nltk.corpus.stopwords.words(stp\_lang)  
> File “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 121, in **getattr**  
> self.\_\_load()  
> File “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 86, in \_\_load  
> raise e  
> File “/home/user/.local/lib/python3.8/site-packages/nltk/corpus/util.py”, line 81, in \_\_load  
> root = nltk.data.find(f"{self.subdir}/{self.\_\_name}")  
> File “/home/user/.local/lib/python3.8/site-packages/nltk/data.py”, line 583, in find  
> raise LookupError(resource\_not\_found)  
> LookupError:
> 
> * * *
> 
> Resource e[93mstopwordse[0m not found.  
> Please use the NLTK Downloader to obtain the resource:
> 
> e[31m\>\>\> import nltk
> 
> > > > nltk.download(‘stopwords’)  
> > > > e[0m  
> > > > For more information see: [NLTK :: Installing NLTK Data](https://www.nltk.org/data.html)
> 
> Attempted to load e[93mcorpora/stopwordse[0m
> 
> Searched in:  
> - ‘/home/user/nltk\_data’  
> - ‘/usr/local/nltk\_data’  
> - ‘/usr/local/share/nltk\_data’  
> - ‘/usr/local/lib/nltk\_data’  
> - ‘/usr/share/nltk\_data’  
> - ‘/usr/local/share/nltk\_data’  
> - ‘/usr/lib/nltk\_data’  
> - ‘/usr/local/lib/nltk\_data’

---

<div class="post-metadata">

**Author:** ![merve](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/merve/32/49809_2.png) [@merve](https://discuss.huggingface.co/u/merve)\
**Post date:** [December 29, 2021, 11:26am UTC](https://discuss.huggingface.co/t/how-to-debug-spaces-on-hf-co/13191/4 "2021-12-29T11:26:07Z")

</div>

Ah I completely forgot this! 😅

You might have NLTK packages that are on your local but not Spaces, that’s why it works on local imo.

---

<div class="post-metadata">

**Author:** ![pszemraj](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pszemraj/32/17720_2.png) [@pszemraj](https://discuss.huggingface.co/u/pszemraj)\
**Post date:** [February 14, 2022, 7:01pm UTC](https://discuss.huggingface.co/t/how-to-debug-spaces-on-hf-co/13191/5 "2022-02-14T19:01:03Z")

</div>

Thanks so much, and sorry for my super late response. Adding some details for you / others that may come across this post later:

- the space in question was [this one](https://huggingface.co/spaces/pszemraj/ballpark-trivia)
- nltk packages were indeed the culprit - after installing, it worked fine.
- what I was ultimately looking for, though, has since been handled/upgraded. It is now much more obvious how to see the logs (see below image), which I struggled to find when you had to click on the “error” icon to see logs.  
 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/0/034c4b9bfbf21e80a6b198273ca9a07f920b047c.png)
