简体   繁体   English

线程中的 Pytorch 异常:ValueError:信号编号 32 超出范围

[英]Pytorch Exception in Thread: ValueError: signal number 32 out of range

I'm getting this error:我收到此错误:

Exception in Thread: ValueError: signal number 32 out of range

The specific tutorial that raises an issue for me is the training a classifier ( https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html ), the specific line is:给我带来问题的具体教程是训练分类器( https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html ),具体行是:

dataiter = iter(trainloader) 

and the full error traceback is:完整的错误回溯是:

Exception in thread Thread-5:
Traceback (most recent call last):
File "/home/chenchen/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/chenchen/anaconda3/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/chenchen/anaconda3/lib/python3.6/multiprocessing/resource_sharer.py", line 139, in _serve
signal.pthread_sigmask(signal.SIG_BLOCK, range(1, signal.NSIG))
File "/home/chenchen/anaconda3/lib/python3.6/signal.py", line 60, in pthread_sigmask
sigs_set = _signal.pthread_sigmask(how, mask)
ValueError: signal number 32 out of range

My operation system is Ubuntu 18.10 and my python env is Anaconda3 for python 3.6.我的操作系统是 Ubuntu 18.10,我的 python 环境是 python 3.6 的 Anaconda3。 I installed pytorch from the latest source.我从最新源安装了 pytorch。 My cuda version is 10.0.我的 cuda 版本是 10.0。

我遇到了类似的问题,当我设置时它得到了解决:

num_workers=0

Looks like this was a bug in Python ( https://bugs.python.org/issue33329 ).看起来这是 Python 中的一个错误 ( https://bugs.python.org/issue33329 )。

For Python 3.6 , it got fixed in 3.6.6, released around July 2019 (see the release notes mentioning it).对于 Python 3.6 ,它在 3.6.6 中得到修复,于 2019 年 7 月左右发布(请参阅提及它的发行说明)。 (You can check which version you have by running python3 --version .) (您可以通过运行python3 --version来检查您的python3 --version 。)

For Python 3.5 , you'd want at least 3.5.7 (... release notes ).对于 Python 3.5 ,您至少需要 3.5.7 (... 发行说明)。

Meanwhile... I haven't tried this personally, but Ubuntu 18.10 seems to have Python 3.6.7 available , so a simple sudo apt install python3.6 might solve this?同时......我还没有亲自尝试过,但 Ubuntu 18.10似乎有 Python 3.6.7 可用,所以一个简单的sudo apt install python3.6可能会解决这个问题?

我使用pip install python==3.6.1将 python 版本从 3.5 更新到pip install python==3.6.1并解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM