我有一个安装了jupyterlab / jupyter笔记本的jupyterhub。 我安装了ijavascript扩展程序。 启动jupyter笔记本并使用JavaScript内核打开一个新笔记本,我收到消息:“内核正在启动,请稍候...”
在控制台上,我收到以下消息:
[I 15:22:24.145 NotebookApp] KernelRestarter: restarting kernel (4/5),
new random ports internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module '../build/Release/zmq.node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/opt/anaconda3/lib/node_modules/ijavascript/node_modules/zeromq/lib/index.js:6:11)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
我的系统是Ubuntu 18.4
我在“ / opt / anaconda3”中以根用户身份安装了“ Anaconda3-2018.12-Linux-x86_64.sh”。
Jupyter笔记本,jupyterlab和jupyterhub运行良好。 Python3内核笔记本运行良好,我可以安装几个jupyter labextensions:
JupyterLab v0.35.4
Known labextensions:
app dir: /opt/anaconda3/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v0.38.1 enabled OK
@jupyterlab/hub-extension v0.12.0 enabled OK
@jupyterlab/latex v0.6.1 enabled OK
@jupyterlab/plotly-extension v0.18.2 enabled OK
@jupyterlab/xkcd-extension v0.6.0 enabled OK
@krassowski/jupyterlab_go_to_definition v0.1.4 enabled OK
@lckr/jupyterlab_variableinspector v0.1.0 enabled OK
@mflevine/jupyterlab_html v0.1.4 enabled OK
jupyter-matplotlib v0.3.0 enabled OK
jupyterlab-drawio v0.5.0 enabled OK
jupyterlab_bokeh v0.6.3 enabled OK
在安装好nodejs并在.npmrc中添加代理信息(已经设置了/ etc / environment)之后,我可以在安装好nodejs之后安装javascript内核:
conda install nodejs
conda install -c krinsman ijavascript
/opt/anaconda3/bin/npm install -g ijavascript
我尝试过的某个地方 / opt / anaconda3 / bin / npm install -g zeromq
由于我在尝试安装ijsinstall时收到错误消息。
最后,我可以使用以下命令安装内核:
/opt/anaconda3/bin/ijsinstall --spec-path=full --install=global
内核(链接,条目等)在jupyter笔记本以及jupyterlab的启动窗口中都可用。但是,过一会儿之后,与内核就没有连接了。 (在jupyterlab中显示“无内核”) 在控制台上,我收到上述错误消息(用于juypter笔记本):
Error: Cannot find module '../build/Release/zmq.node'
at Function.Module._resolveFilename internal/modules/cjs/loader.js:580:15)
A
find /opt/anaconda3 -name "zmq.node"
返回以下内容:
/opt/anaconda3/pkgs/ijavascript-v5.0.20-0/lib/node_modules/ijavascript/node_modules/zeromq/build/Release/zmq.node
/opt/anaconda3/lib/node_modules/zeromq/build/Release/zmq.node
尝试“ ijskernel”会给出相同的错误消息,以及:
ijsnotebook --allow-root
我必须以其他方式安装ijavascript吗? 我是否必须在其他地方复制/链接zmq.node? 以root身份运行还是以服务身份运行是问题所在?
在/ opt / anaconda3中运行以下命令:
grep --include=\*.js -rnw -e 'build/Release/zmq.node'
我发现:
pkgs/ijavascript-v5.0.20-0/lib/node_modules/ijavascript/node_modules/zeromq/lib/index.js:6: , zmq = require('../build/Release/zmq.node')
lib/node_modules/zeromq/lib/index.js:6: , zmq = require('../build/Release/zmq.node')
lib/node_modules/ijavascript/node_modules/zeromq/lib/index.js:6: , zmq = require('../build/Release/zmq.node')
同时
find . -name "zmq.node"
发现了以下
./pkgs/ijavascript-v5.0.20-0/lib/node_modules/ijavascript/node_modules/zeromq/build/Release/zmq.node
./lib/node_modules/zeromq/build/Release/zmq.node
卸载ijavascript和zermq并将zmq.node重新安装并复制到错误消息给定的目录中会更改错误消息(尝试ijskernel):
KERNEL: ARGV: [ '/opt/anaconda3/bin/node', '/opt/anaconda3/bin/ijskernel' ]
Usage: node kernel.js [--debug] [--hide-undefined] [--protocol=Major[.minor[.patch]]] [--session-working-dir=path] [--show-undefined] [--startup-script=path] connection_file
/opt/anaconda3/lib/node_modules/ijavascript/lib/kernel.js:190
throw e;
^
Error: Error: missing connection_file
at parseCommandArguments (/opt/anaconda3/lib/node_modules/ijavascript/lib/kernel.js:182:19)
at Object.<anonymous> (/opt/anaconda3/lib/node_modules/ijavascript/lib/kernel.js:46:14)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
ijsnotebook --allow-root
或
jupyter notebook --allow-root
或
jupyter lab --allow-root
运行一个可以连接到javascript内核的本地笔记本。
这无法通过jupyterhub起作用。