英文:
Cannot Start Jupyter IPython Notebook Kernel
问题
我正在使用VSCode的Jupyter Notebooks。
我在启动Python(Sagemath)内核时遇到问题。在VSCode中运行单元格时,出现以下错误文本:
无法启动内核。
未知选项--python
用法:/root/anaconda3/envs/sage/bin/python [选项] ... [-c cmd | -m mod | file | -] [arg] ...
尝试 `python -h` 以获取更多信息。
查看Jupyter日志以获取更多详细信息。
这是日志文件中的一部分:
警告 16:18:12.373:内核错误,上下文 = 启动 [ap [错误]:内核已停止运行。错误:未知选项--python
用法:/root/anaconda3/envs/sage/bin/python [选项] ... [-c cmd | -m mod | file | -] [arg] ...
尝试 `python -h` 以获取更多信息.... 查看Jupyter [日志](command:jupyter.viewOutput) 以获取更多详细信息。
at ChildProcess.<anonymous> (/root/.vscode-server/extensions/ms-toolsai.jupyter-2023.1.2000312134/out/extension.node.js:17:102857)
at ChildProcess.emit (node:events:538:35)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)] {
category: 'kerneldied',
kernelConnectionMetadata: Zd {
kind: 'startUsingPythonInterpreter',
kernelSpec: {
specFile: '/root/anaconda3/envs/sage/share/jupyter/kernels/sagemath/kernel.json',
interpreterPath: '/root/anaconda3/envs/sage/bin/python',
isRegisteredByVSC: 'registeredByNewVersionOfExtForCustomKernelSpec',
name: 'pythonjvsc74a57bd0fbfe4b38fd9276f8fd065521985c9d949b01305ee70753a4e78b421b898ddb3e',
argv: [Array],
language: 'sage',
executable: '/root/anaconda3/envs/sage/bin/sage',
display_name: 'SageMath 9.7',
metadata: [Object]
},
interpreter: {
id: '/root/anaconda3/envs/sage/bin/python',
sysPrefix: '/root/anaconda3/envs/sage',
envPath: [f],
displayPath: [Object],
envName: 'sage',
displayName: 'sage',
envType: 'Conda',
version: [Object],
uri: [f]
},
id: '.jvsc74a57bd0fbfe4b38fd9276f8fd065521985c9d949b01305ee70753a4e78b421b898ddb3e#sagemath./root/anaconda3/envs/sage/python././root/anaconda3/envs/sage/bin/sage#--python#-m#sage.repl.ipython_kernel#-f#{connection_file}'
},
exitCode: 2,
stdErr: 'unknown option --python\n' +
'用法:/root/anaconda3/envs/sage/bin/python [选项] ... [-c cmd | -m mod | file | -] [arg] ...\n' +
"尝试 `python -h` 以获取更多信息。\n"
}
错误 16:18:12.591:未能从Python获取激活的conda环境变量 /root/anaconda3/envs/sage/bin/python
信息 16:18:12.595:进程执行:> ~/anaconda3/envs/sage/bin/python -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
> ~/anaconda3/envs/sage/bin/python -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
信息 16:18:12.763:处置内核 '/path/to/ipynb' 关联的 '/same/path/to/ipynb'
查看了其他类似的内核启动问题,但抛出的错误不同(没有'unknown option --python'),明显实施的解决方案也不起作用。
请让我知道是否需要更多信息以提供帮助!
英文:
I'm using Jupyter Notebooks from VSCode.
I'm having issues starting my Python (Sagemath) Kernel. The error text (when running the cell in VSCode) is as follows:
Failed to start the Kernel.
unknown option --python
usage: /root/anaconda3/envs/sage/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
View Jupyter log for further details.
This is a snippet from the log file:
warn 16:18:12.373: Kernel Error, context = start [ap [Error]: The kernel died. Error: unknown option --python
usage: /root/anaconda3/envs/sage/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.... View Jupyter [log](command:jupyter.viewOutput) for further details.
at ChildProcess.<anonymous> (/root/.vscode-server/extensions/ms-toolsai.jupyter-2023.1.2000312134/out/extension.node.js:17:102857)
at ChildProcess.emit (node:events:538:35)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)] {
category: 'kerneldied',
kernelConnectionMetadata: Zd {
kind: 'startUsingPythonInterpreter',
kernelSpec: {
specFile: '/root/anaconda3/envs/sage/share/jupyter/kernels/sagemath/kernel.json',
interpreterPath: '/root/anaconda3/envs/sage/bin/python',
isRegisteredByVSC: 'registeredByNewVersionOfExtForCustomKernelSpec',
name: 'pythonjvsc74a57bd0fbfe4b38fd9276f8fd065521985c9d949b01305ee70753a4e78b421b898ddb3e',
argv: [Array],
language: 'sage',
executable: '/root/anaconda3/envs/sage/bin/sage',
display_name: 'SageMath 9.7',
metadata: [Object]
},
interpreter: {
id: '/root/anaconda3/envs/sage/bin/python',
sysPrefix: '/root/anaconda3/envs/sage',
envPath: [f],
displayPath: [Object],
envName: 'sage',
displayName: 'sage',
envType: 'Conda',
version: [Object],
uri: [f]
},
id: '.jvsc74a57bd0fbfe4b38fd9276f8fd065521985c9d949b01305ee70753a4e78b421b898ddb3e#sagemath./root/anaconda3/envs/sage/python././root/anaconda3/envs/sage/bin/sage#--python#-m#sage.repl.ipython_kernel#-f#{connection_file}'
},
exitCode: 2,
stdErr: 'unknown option --python\n' +
'usage: /root/anaconda3/envs/sage/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...\n' +
"Try `python -h' for more information.\n"
}
error 16:18:12.591: Failed to get activated conda env variables from Python for /root/anaconda3/envs/sage/bin/python
info 16:18:12.595: Process Execution: > ~/anaconda3/envs/sage/bin/python -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
> ~/anaconda3/envs/sage/bin/python -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
info 16:18:12.763: Dispose Kernel '/path/to/ipynb' associated with '/same/path/to/ipynb'
Took a look at other similar kernel start problems, but the errors thrown were different (NOT one with 'unknown option --python', and the solutions implemented obviously did not work.
Please let me know if you need any more information to help!
答案1
得分: 0
已解决 - 编辑内核的kernel.json文件,删除--python
选项。
英文:
Solved - Edit the kernel.json file of the kernel and remove the --python
option
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论