JupyterLab の kernel に R と JavaScript(node.js)を追加
January 29, 2020 – 4:22 pmJupyterLab上で Pythonに加えて、R言語ならびに JapaScript(node.js)の kernelを追加した。
作業内容を、以下、簡単にメモしておいた。
R kernel をJupyterLabに追加:
libcurl-devel のインストール:
(Rパッケージ devtoolのインストールに必要)
#yum install -y libcurl-devel
JupyterLab動作環境に移行し、
(Rを起動) (base) [tsflow@localhost ~]$ R R version 3.6.0 (2019-04-26) -- "Planting of a Tree" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-redhat-linux-gnu (64-bit) ( 省 略) (Rパケージ devtoolをインストール) > install.packages("devtool") > install.packages("devtools") Installing package into ‘/home/tsflow/R/x86_64-redhat-linux-gnu-library/3.6’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- Secure CRAN mirrors 1: 0-Cloud [https] 2: Algeria [https] 3: Australia (Canberra) [https] 4: Australia (Melbourne 1) [https] 41: Japan (Tokyo) [https] 42: Japan (Yonezawa) [https] Selection: 41 trying URL 'https://cran.ism.ac.jp/src/contrib/devtools_2.2.1.tar.gz' Content type 'application/x-gzip' length 372273 bytes (363 KB) ================================================== (省 略) * DONE (devtools) (インストールした devtoolsでGithubからIRkernelをインストール) > devtools::install_github("IRkernel/IRkernel") (IRkernelとJupyterLabをつなげる) > IRkernel::installspec()
JavaScript(node.js) kernelをJupyterLabに追加:
仮想環境 trial_env上で ijavascriptをnpm install
(trial_env) [tsflow@localhost ~]$ npm install -g ijavascript /home/tsflow/anaconda3/envs/trial_env/bin/ijs -> /home/tsflow/anaconda3/envs/trial_env/lib/node_modules/ijavascript/bin/ijavascript.js /home/tsflow/anaconda3/envs/trial_env/bin/ijsconsole -> /home/tsflow/anaconda3/envs/trial_env/lib/node_modules/ijavascript/bin/ijsconsole.js /home/tsflow/anaconda3/envs/trial_env/bin/ijsinstall -> /home/tsflow/anaconda3/envs/trial_env/lib/node_modules/ijavascript/bin/ijsinstall.js /home/tsflow/anaconda3/envs/trial_env/bin/ijsnotebook -> /home/tsflow/anaconda3/envs/trial_env/lib/node_modules/ijavascript/bin/ijsnotebook.js /home/tsflow/anaconda3/envs/trial_env/bin/ijskernel -> /home/tsflow/anaconda3/envs/trial_env/lib/node_modules/ijavascript/lib/kernel.js > zeromq@5.2.0 install /home/tsflow/anaconda3/envs/trial_env/lib/node_modules/ijavascript/node_modules/zeromq > node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild) + ijavascript@5.2.0 added 64 packages from 62 contributors in 11.593s
javascript kernelを追加(ijsinstall)し、kernelspec listでkernelが追加されていることを確認
(trial_env) [tsflow@localhost ~]$ ijsinstall (trial_env) [tsflow@localhost ~]$ jupyter kernelspec list Available kernels: ir /home/tsflow/.local/share/jupyter/kernels/ir javascript /home/tsflow/.local/share/jupyter/kernels/javascript python3 /home/tsflow/anaconda3/envs/trial_env/share/jupyter/kernels/python3
kernel追加後のJupyterLab スナップショット:
参考にしたサイト: