Getting OS error with dataloader

My code with pytorch has been working fine till now but for last month or so I have been receiving an OS error while using dataloader. Interestingly this error is random and is not repeatable. I tried upgrading to pytorch 0.4 but still facing the same problem. I would appreciate a solution as this is being a menace in my work.


Traceback (most recent call last):
File “./”, line 139, in
for data in trainloader:
File “/usr/local/lib/python2.7/dist-packages/torch/utils/data/”, line 280, in next
idx, batch = self._get_batch()
File “/usr/local/lib/python2.7/dist-packages/torch/utils/data/”, line 259, in _get_batch
return self.data_queue.get()
File “/usr/lib/python2.7/multiprocessing/”, line 378, in get
return recv()
File “/usr/local/lib/python2.7/dist-packages/torch/multiprocessing/”, line 22, in recv
return pickle.loads(buf)
File “/usr/lib/python2.7/”, line 1388, in loads
return Unpickler(file).load()
File “/usr/lib/python2.7/”, line 864, in load
File “/usr/lib/python2.7/”, line 1139, in load_reduce
value = func(*args)
File “/usr/local/lib/python2.7/dist-packages/torch/multiprocessing/”, line 68, in rebuild_storage_fd
fd = multiprocessing.reduction.rebuild_handle(df)
File “/usr/lib/python2.7/multiprocessing/”, line 157, in rebuild_handle
new_handle = recv_handle(conn)
File “/usr/lib/python2.7/multiprocessing/”, line 83, in recv_handle
return _multiprocessing.recvfd(conn.fileno())
OSError: [Errno 4] Interrupted system call

If you suspect this is an IPython bug, please report it at:
or send an email to the mailing list at

You can print a more detailed traceback right now with “%tb”, or use “%debug”
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True

Exception NameError: “global name ‘FileNotFoundError’ is not defined” in <bound method _DataLoaderIter.del of < object at 0x7fda56c31790>> ignored