Forums

Jupyter Notebook "Kernel error"

I'm getting kernel error in all my Jyputer Notebooks. Killing existing tasks does not fix the problem. Thanks!

Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/tornado/web.py", line 1713, in _execute result = await result File "/usr/lib/python3.8/asyncio/tasks.py", line 349, in wakeup future.result() File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 776, in run yielded = self.gen.throw(exc_info) # type: ignore File "/usr/local/lib/python3.8/dist-packages/notebook/services/sessions/handlers.py", line 74, in post model = yield maybe_future( File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 769, in run value = future.result() File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 776, in run yielded = self.gen.throw(exc_info) # type: ignore File "/usr/local/lib/python3.8/dist-packages/notebook/services/sessions/sessionmanager.py", line 98, in create_session kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 769, in run value = future.result() File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 776, in run yielded = self.gen.throw(exc_info) # type: ignore File "/usr/local/lib/python3.8/dist-packages/notebook/services/sessions/sessionmanager.py", line 110, in start_kernel_for_session kernel_id = yield maybe_future( File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 769, in run value = future.result() File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result raise self._exception File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step result = coro.send(None) File "/usr/local/lib/python3.8/dist-packages/notebook/services/kernels/kernelmanager.py", line 176, in start_kernel kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, kwargs)) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/utils.py", line 30, in wrapped raise e File "/usr/local/lib/python3.8/dist-packages/jupyter_client/utils.py", line 27, in wrapped return loop.run_until_complete(future) File "/usr/local/lib/python3.8/dist-packages/nest_asyncio.py", line 89, in run_until_complete return f.result() File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result raise self._exception File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step result = coro.send(None) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/multikernelmanager.py", line 214, in _async_start_kernel starter = ensure_async(km.start_kernel(kwargs)) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/utils.py", line 30, in wrapped raise e File "/usr/local/lib/python3.8/dist-packages/jupyter_client/utils.py", line 27, in wrapped return loop.run_until_complete(future) File "/usr/local/lib/python3.8/dist-packages/nest_asyncio.py", line 89, in run_until_complete return f.result() File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result raise self._exception File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step result = coro.send(None) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/manager.py", line 83, in wrapper raise e File "/usr/local/lib/python3.8/dist-packages/jupyter_client/manager.py", line 75, in wrapper out = await method(self, args, kwargs) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/manager.py", line 389, in _async_start_kernel await ensure_async(self._launch_kernel(kernel_cmd, kw)) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/utils.py", line 30, in wrapped raise e File "/usr/local/lib/python3.8/dist-packages/jupyter_client/utils.py", line 27, in wrapped return loop.run_until_complete(future) File "/usr/local/lib/python3.8/dist-packages/nest_asyncio.py", line 89, in run_until_complete return f.result() File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result raise self._exception File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step result = coro.send(None) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/manager.py", line 307, in _async_launch_kernel connection_info = await self.provisioner.launch_kernel(kernel_cmd, kw) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/provisioning/local_provisioner.py", line 204, in launch_kernel self.process = launch_kernel(cmd, scrubbed_kwargs) File "/usr/local/lib/python3.8/dist-packages/jupyter_client/launcher.py", line 170, in launch_kernel raise ex File "/usr/local/lib/python3.8/dist-packages/jupyter_client/launcher.py", line 158, in launch_kernel proc = Popen(cmd, **kwargs) File "/usr/lib/python3.8/subprocess.py", line 858, in __init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1639, in _execute_child self.pid = _posixsubprocess.fork_exec( BlockingIOError: [Errno 11] Resource temporarily unavailable

Actually it seems that can still use the old notebooks previously created. But I'm not able to create new ones that work (I get this kernel error)

You have a large number of kernels running, so you have hit the limit of how many processes you can have running on one machine. You can kill some of the notebook processes using the "Fetch process list" button on the Consoles page.

thanks that solve my problem.

So I guess I need to "close and halt" all the notebooks when I'm done. What about scripts, do I need to "exit" at the end? (if yes, how?) Sorry for the newbie questions :)

Scripts should just finish when they finish.

so what's the best practice I should follow to avoid running into this problem again?

Periodically check your processes and kill old kernels.