title: How can I keep `jupyter run` from timing out?
body: <p>Starting an Python Jupyter kernel with</p>
  <pre class="lang-sh prettyprint-override"><code>&gt; ipython kernel
  </code></pre>
  <p>and then launching a script in a separate terminal using</p>
  <pre class="lang-sh prettyprint-override"><code>&gt; jupyter run script.py --existing
  </code></pre>
  <p>results in a timeout error after around 10 seconds:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/home/mason/.local/bin/jupyter-run&quot;, line 8, in &lt;module&gt;
      sys.exit(RunApp.launch_instance())
    File &quot;/home/mason/.local/lib/python3.8/site-packages/jupyter_core/application.py&quot;, line 264, in launch_instance
      return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
    File &quot;/home/mason/.local/lib/python3.8/site-packages/traitlets/config/application.py&quot;, line 846, in launch_instance
      app.start()
    File &quot;/home/mason/.local/lib/python3.8/site-packages/jupyter_client/runapp.py&quot;, line 107, in start
      reply = self.kernel_client.execute_interactive(code, timeout=OUTPUT_TIMEOUT)
    File &quot;/home/mason/.local/lib/python3.8/site-packages/jupyter_client/utils.py&quot;, line 26, in wrapped
      raise e
    File &quot;/home/mason/.local/lib/python3.8/site-packages/jupyter_client/utils.py&quot;, line 23, in wrapped
      return loop.run_until_complete(future)
    File &quot;/home/mason/.local/lib/python3.8/site-packages/nest_asyncio.py&quot;, line 81, in run_until_complete
      return f.result()
    File &quot;/usr/lib/python3.8/asyncio/futures.py&quot;, line 178, in result
      raise self._exception
    File &quot;/usr/lib/python3.8/asyncio/tasks.py&quot;, line 280, in __step
      result = coro.send(None)
    File &quot;/home/mason/.local/lib/python3.8/site-packages/jupyter_client/client.py&quot;, line 515, in _async_execute_interactive
      raise TimeoutError(&quot;Timeout waiting for output&quot;)
  TimeoutError: Timeout waiting for output
  </code></pre>
  <p>How can I keep this from happening? I tried looking through the <code>jupyter_client</code> code and changing various IPyKernel configuration options but I haven't had any luck. (What I'm trying to do, ultimately, is use Jupyter/IPyKernel to quickly re-run Python scripts that depend on slow-to-initialize modules like PyTorch.)</p>
  <p>For reference, the only Pip package I needed to install to get this behavior was <code>ipykernel</code>, and the content of <code>script.py</code> is</p>
  <pre class="lang-py prettyprint-override"><code>from time import sleep
  
  for _ in range(20):
      print('Still running')
      sleep(1)
  </code></pre>