在 IRKernel::installspec() 中:jupyter kernelspec --version 以代码 1 退出
In IRKernel::installspec(): jupyter kernelspec --version exits with code one
尝试为 jupyter notebook 安装 IRKernel,我遇到了以下问题:
IRkernel::installspec()
# Results in
# Error in IRkernel::installspec() :
# jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 1.
这与 Windows 需要一个破折号有关。确实,这行不通:
> jupyter kernelspec --version
Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2
虽然这有效:
> jupyter-kernelspec --version
5.2.2
有什么办法解决这个问题吗?
我的OS是
> ver
Microsoft Windows [Version 10.0.16299.431]
我的 sessionInfo():
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 digest_0.6.15 crayon_1.3.4 IRdisplay_0.5.0 repr_0.15.0
[6] jsonlite_1.5 magrittr_1.5 evaluate_0.10.1 stringi_1.1.7 uuid_0.1-2
[11] rstudioapi_0.7 IRkernel_0.8.12.9000 tools_3.5.0 stringr_1.3.1 yaml_2.1.19
[16] compiler_3.5.0 base64enc_0.1-3 pbdZMQ_0.3-3 htmltools_0.3.6
我在这里发布了 Error executing Jupyter command 'kernelspec'
问题:
为了安装 R 内核,我使用的解决方法是调整 installspec function's code 并在本地执行这个调整后的版本。
修改是为了替换:
17: exit_code <- system2('jupyter', c('kernelspec', '--version'), FALSE, FALSE)
42: args <- c('kernelspec', 'install', '--replace', '--name', name, user_flag, prefix_flag, file.path(tmp_name, 'kernelspec'))
43: exit_code <- system2('jupyter', args)
作者:
17: exit_code <- system2('jupyter-kernelspec', '--version', FALSE, FALSE)
42: args <- c('install', '--replace', '--name', name, user_flag, prefix_flag, file.path(tmp_name, 'kernelspec'))
43: exit_code <- system2('jupyter-kernelspec', args)
EDIT 这里有一个更好、更简单的解决方法:
尝试为 jupyter notebook 安装 IRKernel,我遇到了以下问题:
IRkernel::installspec()
# Results in
# Error in IRkernel::installspec() :
# jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 1.
这与 Windows 需要一个破折号有关。确实,这行不通:
> jupyter kernelspec --version
Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2
虽然这有效:
> jupyter-kernelspec --version
5.2.2
有什么办法解决这个问题吗?
我的OS是
> ver
Microsoft Windows [Version 10.0.16299.431]
我的 sessionInfo():
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 digest_0.6.15 crayon_1.3.4 IRdisplay_0.5.0 repr_0.15.0
[6] jsonlite_1.5 magrittr_1.5 evaluate_0.10.1 stringi_1.1.7 uuid_0.1-2
[11] rstudioapi_0.7 IRkernel_0.8.12.9000 tools_3.5.0 stringr_1.3.1 yaml_2.1.19
[16] compiler_3.5.0 base64enc_0.1-3 pbdZMQ_0.3-3 htmltools_0.3.6
我在这里发布了 Error executing Jupyter command 'kernelspec'
问题:
为了安装 R 内核,我使用的解决方法是调整 installspec function's code 并在本地执行这个调整后的版本。
修改是为了替换:
17: exit_code <- system2('jupyter', c('kernelspec', '--version'), FALSE, FALSE)
42: args <- c('kernelspec', 'install', '--replace', '--name', name, user_flag, prefix_flag, file.path(tmp_name, 'kernelspec'))
43: exit_code <- system2('jupyter', args)
作者:
17: exit_code <- system2('jupyter-kernelspec', '--version', FALSE, FALSE)
42: args <- c('install', '--replace', '--name', name, user_flag, prefix_flag, file.path(tmp_name, 'kernelspec'))
43: exit_code <- system2('jupyter-kernelspec', args)
EDIT 这里有一个更好、更简单的解决方法: