New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: I/O operation on closed file #9168
Comments
What steps caused that? |
Long running script with large cell output, cannot share the whole notebook On Mon, Jan 25, 2016, 12:42 PM Thomas Kluyver notifications@github.com
|
So it was something you were running from the notebook? Is it possible that something in it could have called |
Notebook, very unlikely that anything called sys.stdout.close() BTW, this is not reproducible if I run simulation again. On Mon, Jan 25, 2016, 2:18 PM Thomas Kluyver notifications@github.com
|
You mean it only comes up once per kernel, or you can't reproduce it at all? |
At all On Tue, Jan 26, 2016, 5:00 AM Thomas Kluyver notifications@github.com
|
OK, closing as we haven't really got much chance of working out what went wrong. Feel free to add info, we can reopen if we identify something. |
I've just encountered similar issue with Jupyter Notebook and massive Keras output (about 700k cell updates in several seconds). Additional information: remote Jupyter Server (Ubuntu 14.04, Python 2.7.6, latest Jupyter from PyPI [jupyter-client==4.2.2, jupyter-console==4.1.1, jupyter-core==4.1.0, ipython==4.1.2]) Local: OSX, Google Chrome 48.0. PS. Similar issue: https://groups.google.com/forum/#!msg/keras-users/_2s1PaoSL58/6539n-oOBgAJ |
Another (probably similar) issue and workaround: http://stackoverflow.com/questions/33958905/watch-long-term-process-in-ipython-notebook |
The case in the SO question is simple enough: the user has replaced We could reset |
Same issue here: Ipython/Jupyter versions exactly the same as stromnov's, but it's Windows 64, Python 2.7.10 The issue appears only in Ipython/Jupyter notebook. Exporting noteboot to pure python and running it removes the problem.
|
Same issue here. Running Very strange as looking at the trace logs it happened after a ADDED: chasing back the stack, at line 40 of Z:\python_src\matrix\src\gpp.pyc in solveCash(csv_file, cash_limit, src_path, output_dir)
261 .format(key, acct_oad[key], final[key]['CASH']))
262 else:
--> 263 print('Problem happens here')
264
265 # return neg_cash
C:\Developer\Anaconda2\lib\site-packages\colorama\ansitowin32.pyc in write(self, text)
38
39 def write(self, text):
---> 40 self.__convertor.write(text)
41
42
C:\Developer\Anaconda2\lib\site-packages\colorama\ansitowin32.pyc in write(self, text)
139 def write(self, text):
140 if self.strip or self.convert:
--> 141 self.write_and_convert(text)
142 else:
143 self.wrapped.write(text)
C:\Developer\Anaconda2\lib\site-packages\colorama\ansitowin32.pyc in write_and_convert(self, text)
167 self.convert_ansi(*match.groups())
168 cursor = end
--> 169 self.write_plain_text(text, cursor, len(text))
170
171
C:\Developer\Anaconda2\lib\site-packages\colorama\ansitowin32.pyc in write_plain_text(self, text, start, end)
172 def write_plain_text(self, text, start, end):
173 if start < end:
--> 174 self.wrapped.write(text[start:end])
175 self.wrapped.flush()
176
C:\Developer\Anaconda2\lib\site-packages\ipykernel\iostream.pyc in write(self, string)
315
316 is_child = (not self._is_master_process())
--> 317 self._buffer.write(string)
318 if is_child:
319 # newlines imply flush in subprocesses
ValueError: I/O operation on closed file |
@esvhd can you provide an example script? It's strange that it's getting I/O on closed file on a StringIO object. |
@minrk It appears to be happening at random, but always at some The only obvious and direct I/O in my own code would be a few Let me see if I can reliability replicate this in a standalone script. Just to add, this code runs in a single process, no multi-threading or multi-processing in the code. |
It's writing to sys.stdout (which print does) that's failing, so that makes sense. I'm just trying to figure out how it's managing to fail. Does it print a whole bunch? Does it start any subprocesses, perhaps with joblib or multiprocessing? |
@minrk So it prints out around 300+ lines of text when it works. It sometimes does work btw. ADDED: chasing back the stack, at line 40 of Also if I run the same script in a console, it works just fine, no errors, obviously. |
I'm not sure why this issue is marked closed since lots of people are still running into it. I hit it frequently when running Keras, as do other people based on comments above |
In case it helps anyone, I just ran into this issue while using https://github.com/tqdm/tqdm in a version of the ipykernel that doesn't include ipython/ipykernel#123 |
It seems the issue isn't fixed in the latest stable release of IPython notebook for Python 2.7 as reported here: keras-team/keras#2110 Maybe ipython/ipykernel#123 isn't yet available in the stable release? Otherwise, it seems this didn't fix the issue... |
You're right that ipython/ipykernel#123 is not in a release yet: it has milestone 4.4, while the released ipykernel is 4.3.1. |
Working on a 4.4 release shortly. |
Ah great to know, so the issue may be fixed in 4.4, that's good news :) 2016-08-01 17:14 GMT+02:00 Min RK notifications@github.com:
|
I ran into this when using |
The text was updated successfully, but these errors were encountered: