I have a jupyterhub with jupyterlab / jupyter notebook installed. I installed the ijavascript extension. Launching jupyter notebook and opening a new notebook with a javascript kernel I get the message: "Kernel starting, please wait..."
At the console I get the following messages:
[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)
My system is Ubuntu 18.4
I have "Anaconda3-2018.12-Linux-x86_64.sh" installed as root in "/opt/anaconda3".
Jupyter notebooks, jupyterlab and jupyterhub are running fine. The Python3 kernel notebooks are running perfectly and I could install several 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
After having nodejs installed and adding proxy information in .npmrc (/etc/environment was already set) I could install the javascript kernel after I had nodejs installed:
conda install nodejs
conda install -c krinsman ijavascript
/opt/anaconda3/bin/npm install -g ijavascript
Somewhere on the line I tried /opt/anaconda3/bin/npm install -g zeromq
Since I received errors trying to install ijsinstall.
Finally I could install the kernel with:
/opt/anaconda3/bin/ijsinstall --spec-path=full --install=global
The kernel (links, entries and such) is available in the jupyter notebook as well as on the starter window of jupyterlab. However after a short while there is no connection with the kernel. ("No Kernel" showing in jupyterlab) On the console I get the above mentioned error message (for juypter notebook):
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"
returns the following:
/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
Trying "ijskernel" gives the same error message as well as:
ijsnotebook --allow-root
Do I have to install ijavascript differently? Do I have to copy/link zmq.node somewhere else? Is running as root or running as a service the problem?
Running the following command in /opt/anaconda3:
grep --include=\*.js -rnw -e 'build/Release/zmq.node'
I found:
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')
while
find . -name "zmq.node"
found the following
./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
Uninstalling ijavascript and zermq and reinstalling and copying of zmq.node into the directory given by the error message changes the error message (trying 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
or
jupyter notebook --allow-root
or
jupyter lab --allow-root
get a local notebook running which can connect to the javascript kernel.
This is not working via jupyterhub.
It seems to boil down to:
https://github.com/n-riesco/ijavascript/issues/184
I could not figure out how I have to install zeromq though.