在 Jupyter Notebook 中使用 conda 环境
Use conda environment in Jupyter Notebook
我在 运行 Anaconda windows 10 上使用 Jupyter Notebook 进行我的机器学习项目。
我最近开始了解 conda 中的虚拟环境。
我使用以下命令在 conda 中创建了一个虚拟环境
conda create -n test1
激活环境
activate test1
ipykernel 中的安装环境(不确定使用的术语是否正确)
python -m ipykernel install --user --name test1
现在环境 test1
在 jupyter notebook 中可见,但是当我启动它时我收到 kernel starting... please wait
消息。
这里有一些片段。
同样在 jupyter 提示符下(再次不确定条款)我收到以下错误
[I 21:08:24.924 NotebookApp] Creating new notebook in /MachineLearning/ImageProcessing
[I 21:08:29.550 NotebookApp] Kernel started: ec56795d-df5b-48d5-8f95-473ab1253407
Traceback (most recent call last):
File "C:\Users\shesh\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\shesh\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\decorator.py:decorator-gen-125>", line 2, in initialize
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 527, in initialize
self.init_sockets()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 287, in init_sockets
self.init_iopub(context)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 295, in init_iopub
self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\iostream.py", line 68, in __init__
self._setup_pipe_in()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\iostream.py", line 141, in _setup_pipe_in
self._pipe_in = ZMQStream(pipe_in, self.io_loop)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__
self._init_io_state()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\zmq\eventloop\zmqstream.py", line 546, in _init_io_state
self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Users\shesh\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
[W 21:09:29.591 NotebookApp] Timeout waiting for kernel_info reply from ec56795d-df5b-48d5-8f95-473ab1253407
[I 21:10:29.197 NotebookApp] Saving file at /MachineLearning/ImageProcessing/Untitled.ipynb
我只想在 jupyter notebook 中使用新创建的环境。
请尝试以下步骤:
source activate test1
conda install ipykernel
ipython kernel install --name test1 --user
我在 运行 Anaconda windows 10 上使用 Jupyter Notebook 进行我的机器学习项目。
我最近开始了解 conda 中的虚拟环境。
我使用以下命令在 conda 中创建了一个虚拟环境
conda create -n test1
激活环境
activate test1
ipykernel 中的安装环境(不确定使用的术语是否正确)
python -m ipykernel install --user --name test1
现在环境 test1
在 jupyter notebook 中可见,但是当我启动它时我收到 kernel starting... please wait
消息。
这里有一些片段。
同样在 jupyter 提示符下(再次不确定条款)我收到以下错误
[I 21:08:24.924 NotebookApp] Creating new notebook in /MachineLearning/ImageProcessing
[I 21:08:29.550 NotebookApp] Kernel started: ec56795d-df5b-48d5-8f95-473ab1253407
Traceback (most recent call last):
File "C:\Users\shesh\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\shesh\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\decorator.py:decorator-gen-125>", line 2, in initialize
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 527, in initialize
self.init_sockets()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 287, in init_sockets
self.init_iopub(context)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 295, in init_iopub
self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\iostream.py", line 68, in __init__
self._setup_pipe_in()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\ipykernel\iostream.py", line 141, in _setup_pipe_in
self._pipe_in = ZMQStream(pipe_in, self.io_loop)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__
self._init_io_state()
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\zmq\eventloop\zmqstream.py", line 546, in _init_io_state
self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ)
File "C:\Users\shesh\AppData\Roaming\Python\Python38\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Users\shesh\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
[W 21:09:29.591 NotebookApp] Timeout waiting for kernel_info reply from ec56795d-df5b-48d5-8f95-473ab1253407
[I 21:10:29.197 NotebookApp] Saving file at /MachineLearning/ImageProcessing/Untitled.ipynb
我只想在 jupyter notebook 中使用新创建的环境。
请尝试以下步骤:
source activate test1
conda install ipykernel
ipython kernel install --name test1 --user