在IRKernel :: installspec()中:jupyter kernelspec --version以代码1退出

时间:2018-05-22 12:30:41

标签: r jupyter-notebook jupyter jupyter-irkernel

尝试为jupyter笔记本安装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

这有什么办法吗?

我的操作系统

> 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     

1 个答案:

答案 0 :(得分:2)

我在这里发布了Error executing Jupyter command 'kernelspec'问题: 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)