今天在使用venv启动python虚拟环境,发现jupyter启动内核失败,error信息:
Traceback (most recent call last):
File "\env\lib\site-packages\traitlets\traitlets.py", line 537, in get
value = obj._trait_values[self.name]
KeyError: 'context'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "\env\lib\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "\Python39\lib\asyncio\tasks.py", line 328, in __wakeup
future.result()
File "\env\lib\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "\env\lib\site-packages\notebook\services\sessions\handlers.py", line 74, in post
model = yield maybe_future(
File "\env\lib\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "\env\lib\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "\env\lib\site-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 "\env\lib\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "\env\lib\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "\env\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 110, in start_kernel_for_session
kernel_id = yield maybe_future(
File "\env\lib\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "\Python39\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "\Python39\lib\asyncio\tasks.py", line 256, in __step
result = coro.send(None)
File "\env\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 176, in start_kernel
kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
File "\env\lib\site-packages\jupyter_client\utils.py", line 26, in wrapped
raise e
File "\env\lib\site-packages\jupyter_client\utils.py", line 23, in wrapped
return loop.run_until_complete(future)
File "\env\lib\site-packages\nest_asyncio.py", line 89, in run_until_complete
return f.result()
File "\Python39\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "\Python39\lib\asyncio\tasks.py", line 256, in __step
result = coro.send(None)
File "\env\lib\site-packages\jupyter_client\multikernelmanager.py", line 198, in _async_start_kernel
km, kernel_name, kernel_id = self.pre_start_kernel(kernel_name, kwargs)
File "\env\lib\site-packages\jupyter_client\multikernelmanager.py", line 157, in pre_start_kernel
km = self.kernel_manager_factory(
File "\env\lib\site-packages\jupyter_client\multikernelmanager.py", line 82, in create_kernel_manager
if self.context.closed:
File "\env\lib\site-packages\traitlets\traitlets.py", line 577, in __get__
return self.get(obj, cls)
File "\env\lib\site-packages\traitlets\traitlets.py", line 540, in get
default = obj.trait_defaults(self.name)
File "\env\lib\site-packages\traitlets\traitlets.py", line 1580, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "\env\lib\site-packages\traitlets\traitlets.py", line 977, in __call__
return self.func(*args, **kwargs)
File "\env\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in _context_default
return zmq.Context()
File "zmq\backend\cython\context.pyx", line 48, in zmq.backend.cython.context.Context.__cinit__
zmq.error.ZMQError: Network is down