'ValueError: signal only works in main thread' when using with streamlit
I tried to import dgl from within a streamlit app, and got an exception ValueError: signal only works in main thread. I guess streamlit runs scripts in a non-main thread, and dgl tries to override the signal handler here: https://github.com/dmlc/dgl/blob/346bc235565a617a0c76074c25019d6dd0003ece/python/dgl/network.py#L27
Overriding the signal handler during library import doesn't feel right. Since right now the handler doesn't seem to do anything useful anyway, I would suggest simply removing it.
To reproduce:
echo "import dgl" > dgl_signal_bug.py && streamlit run dgl_signal_bug.py
cc @aksnzhy
@sergei-grechanik Hi, I have fixed this issue by removing the signal handler https://github.com/dmlc/dgl/pull/1171.
Thanks so much!
hi, I'm getting this error too. Would you let me know how you fixed it? Thanks!