n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

Kernel DoA #78

Closed ryan-williams closed 7 years ago

ryan-williams commented 8 years ago

I just installed 5.0.13 via npm, ran ijs, tried to create a Node-kernel notebook, and the kernel repeatedly dies at startup.

Server output:

[I 16:28:19.339 NotebookApp] Serving notebooks from local directory: /Users/ryan
[I 16:28:19.339 NotebookApp] 0 active kernels
[I 16:28:19.339 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 16:28:19.339 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 16:28:29.978 NotebookApp] Creating new notebook in
[I 16:28:31.321 NotebookApp] Kernel started: d9d628c4-0883-44bf-82cc-fe6eebe1a860
[I 16:28:34.306 NotebookApp] KernelRestarter: restarting kernel (1/5)
[I 16:28:37.316 NotebookApp] KernelRestarter: restarting kernel (2/5)
[I 16:28:40.328 NotebookApp] KernelRestarter: restarting kernel (3/5)
[W 16:28:41.386 NotebookApp] Timeout waiting for kernel_info reply from d9d628c4-0883-44bf-82cc-fe6eebe1a860
[I 16:28:43.343 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel d9d628c4-0883-44bf-82cc-fe6eebe1a860 restarted
[W 16:28:46.372 NotebookApp] KernelRestarter: restart failed
[W 16:28:46.373 NotebookApp] Kernel d9d628c4-0883-44bf-82cc-fe6eebe1a860 died, removing from map.
ERROR:root:kernel d9d628c4-0883-44bf-82cc-fe6eebe1a860 restarted failed!
[W 16:28:46.399 NotebookApp] Kernel deleted before session
[W 16:28:46.399 NotebookApp] 410 DELETE /api/sessions/dccd4a81-927d-40c3-84d4-2dd49acec0f5 (::1) 2.00ms referer=http://localhost:8888/notebooks/Untitled.ipynb?kernel_name=javascript

Notebook and JS console:

Let me know if anything jumps out, thanks!

n-riesco commented 8 years ago

This issue should be fixed in the latest release (IJavascript v5.0.14). Please, feel free to reopen if this issue is still present after updating.

periscuelo commented 8 years ago

For me this error persist in version 5.0.14

n-riesco commented 8 years ago

On 20/09/16 17:41, periscuelo wrote:

For me this error persist in version 5.0.14

Could you post which the versions you're using?

$ ijs --version $ npm version $ jupyter --version

Also could you post the output of running ijs --ijs-debug?

periscuelo commented 8 years ago

I'm using: Windows 10 Python 3.5.2 ijs 5.0.14 nodejs 6.5.0 npm 3.10.6 Jupyter 4.2.0

IJS: CONTEXT: { path: 
   { node: 'C:\\Program Files\\nodejs\\node.exe',
     root: 'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript',
     kernel: 'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript\\lib\\kernel.js',
     images: 'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript\\images' },
  packageJSON: 
   { _args: [ [Object] ],
     _from: 'ijavascript@latest',
     _id: 'ijavascript@5.0.14',
     _inCache: true,
     _installable: true,
     _location: '/ijavascript',
     _nodeVersion: '4.5.0',
     _npmOperationalInternal: 
      { host: 'packages-16-east.internal.npmjs.com',
        tmp: 'tmp/ijavascript-5.0.14.tgz_1473067136958_0.6678676137235016' },
     _npmUser: { name: 'n-riesco', email: 'enquiries@nicolasriesco.net' },
     _npmVersion: '2.15.9',
     _phantomChildren: {},
     _requested: 
      { raw: 'ijavascript',
        scope: null,
        escapedName: 'ijavascript',
        name: 'ijavascript',
        rawSpec: '',
        spec: 'latest',
        type: 'tag' },
     _requiredBy: [ '#USER' ],
     _resolved: 'https://registry.npmjs.org/ijavascript/-/ijavascript-5.0.14.tgz',
     _shasum: 'f41302bcb7d748da5239f376b658658513925b0d',
     _shrinkwrap: null,
     _spec: 'ijavascript',
     _where: 'C:\\Users\\myuser',
     author: 
      { email: 'enquiries@nicolasriesco.net',
        url: 'http://www.nicolasriesco.net/' },
     bin: { ijs: 'bin/ijavascript.js' },
     bugs: { url: 'https://github.com/n-riesco/ijavascript/issues' },
     contributors: 
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     dependencies: { 'jp-kernel': '0.0.x' },
     description: 'IJavascript is a Javascript kernel for the Jupyter notebook',
     devDependencies: { debug: 'latest', jsdoc: 'latest', jshint: 'latest' },
     directories: {},
     dist: 
      { shasum: 'f41302bcb7d748da5239f376b658658513925b0d',
        tarball: 'https://registry.npmjs.org/ijavascript/-/ijavascript-5.0.14.tgz' },
     gitHead: '25f046609db427b059734c7047d608a41fe75584',
     homepage: 'https://n-riesco.github.io/ijavascript',
     keywords: [ 'javascript', 'kernel', 'ipython', 'jupyter' ],
     license: 'BSD-3-Clause',
     maintainers: [ [Object] ],
     name: 'ijavascript',
     optionalDependencies: {},
     readme: 'ERROR: No README data found!',
     repository: 
      { type: 'git',
        url: 'git+https://github.com/n-riesco/ijavascript.git' },
     scripts: 
      { doc: 'python scripts/doc-build.py',
        'doc:publish': 'node scripts/doc-publish.js gh-pages https://github.com/n-riesco/ijavascript',
        lint: 'jshint bin lib',
        test: 'npm run lint && npm run test:4 && npm run test:5',
        'test:4': 'node test/index.js --protocol=4.1',
        'test:5': 'node test/index.js --protocol=5.0' },
     version: '5.0.14' },
  flag: { debug: true },
  args: 
   { kernel: 
      [ 'C:\\Program Files\\nodejs\\node.exe',
        'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript\\lib\\kernel.js',
        '--debug',
        '{connection_file}',
        '--protocol=5.0' ],
     frontend: [ 'jupyter', 'notebook' ] },
  protocol: { version: '5.0', majorVersion: 5 },
  frontend: { version: '4.2.0', majorVersion: 4 } }
[I 14:30:46.305 NotebookApp] Serving notebooks from local directory: D:\jupyter
[I 14:30:46.305 NotebookApp] 0 active kernels 
[I 14:30:46.305 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 14:30:46.305 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Thanks for quick response!

n-riesco commented 8 years ago

On 20/09/16 18:32, periscuelo wrote:

I'm using: Windows 10 Python 3.5.2 Jupyter 4.2.0 npm 3.10.6

When you run ijs --ijs-debug, I'd like to see the log after opening a new JS notebook in the frontend. I'm hoping ijs will report what's causing the kernel to die.

periscuelo commented 8 years ago

Ok lets go now.

IJS: CONTEXT: { path: 
   { node: 'C:\\Program Files\\nodejs\\node.exe',
     root: 'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript',
     kernel: 'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript\\lib\\kernel.js',
     images: 'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript\\images' },
  packageJSON: 
   { _args: [ [Object] ],
     _from: 'ijavascript@latest',
     _id: 'ijavascript@5.0.14',
     _inCache: true,
     _installable: true,
     _location: '/ijavascript',
     _nodeVersion: '4.5.0',
     _npmOperationalInternal: 
      { host: 'packages-16-east.internal.npmjs.com',
        tmp: 'tmp/ijavascript-5.0.14.tgz_1473067136958_0.6678676137235016' },
     _npmUser: { name: 'n-riesco', email: 'enquiries@nicolasriesco.net' },
     _npmVersion: '2.15.9',
     _phantomChildren: {},
     _requested: 
      { raw: 'ijavascript',
        scope: null,
        escapedName: 'ijavascript',
        name: 'ijavascript',
        rawSpec: '',
        spec: 'latest',
        type: 'tag' },
     _requiredBy: [ '#USER' ],
     _resolved: 'https://registry.npmjs.org/ijavascript/-/ijavascript-5.0.14.tgz',
     _shasum: 'f41302bcb7d748da5239f376b658658513925b0d',
     _shrinkwrap: null,
     _spec: 'ijavascript',
     _where: 'C:\\Users\\myuser',
     author: 
      { email: 'enquiries@nicolasriesco.net',
        url: 'http://www.nicolasriesco.net/' },
     bin: { ijs: 'bin/ijavascript.js' },
     bugs: { url: 'https://github.com/n-riesco/ijavascript/issues' },
     contributors: 
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     dependencies: { 'jp-kernel': '0.0.x' },
     description: 'IJavascript is a Javascript kernel for the Jupyter notebook',
     devDependencies: { debug: 'latest', jsdoc: 'latest', jshint: 'latest' },
     directories: {},
     dist: 
      { shasum: 'f41302bcb7d748da5239f376b658658513925b0d',
        tarball: 'https://registry.npmjs.org/ijavascript/-/ijavascript-5.0.14.tgz' },
     gitHead: '25f046609db427b059734c7047d608a41fe75584',
     homepage: 'https://n-riesco.github.io/ijavascript',
     keywords: [ 'javascript', 'kernel', 'ipython', 'jupyter' ],
     license: 'BSD-3-Clause',
     maintainers: [ [Object] ],
     name: 'ijavascript',
     optionalDependencies: {},
     readme: 'ERROR: No README data found!',
     repository: 
      { type: 'git',
        url: 'git+https://github.com/n-riesco/ijavascript.git' },
     scripts: 
      { doc: 'python scripts/doc-build.py',
        'doc:publish': 'node scripts/doc-publish.js gh-pages https://github.com/n-riesco/ijavascript',
        lint: 'jshint bin lib',
        test: 'npm run lint && npm run test:4 && npm run test:5',
        'test:4': 'node test/index.js --protocol=4.1',
        'test:5': 'node test/index.js --protocol=5.0' },
     version: '5.0.14' },
  flag: { debug: true },
  args: 
   { kernel: 
      [ 'C:\\Program Files\\nodejs\\node.exe',
        'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\ijavascript\\lib\\kernel.js',
        '--debug',
        '{connection_file}',
        '--protocol=5.0' ],
     frontend: [ 'jupyter', 'notebook' ] },
  protocol: { version: '5.0', majorVersion: 5 },
  frontend: { version: '4.2.0', majorVersion: 4 } }
[I 17:28:58.236 NotebookApp] Serving notebooks from local directory: D:\jupyter
[I 17:28:58.236 NotebookApp] 0 active kernels 
[I 17:28:58.236 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 17:28:58.236 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 17:28:58.947 NotebookApp] Saving file at /Untitled.ipynb
[I 17:29:11.380 NotebookApp] Creating new notebook in 
[I 17:29:13.379 NotebookApp] Kernel started: c76681cb-6397-4100-9f88-2ca93d4e9485
[I 17:29:16.364 NotebookApp] KernelRestarter: restarting kernel (1/5)
[I 17:29:19.538 NotebookApp] KernelRestarter: restarting kernel (2/5)
[I 17:29:22.740 NotebookApp] KernelRestarter: restarting kernel (3/5)
[W 17:29:23.444 NotebookApp] Timeout waiting for kernel_info reply from c76681cb-6397-4100-9f88-2ca93d4e9485
[I 17:29:25.944 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel c76681cb-6397-4100-9f88-2ca93d4e9485 restarted
[W 17:29:29.158 NotebookApp] KernelRestarter: restart failed
[W 17:29:29.158 NotebookApp] Kernel c76681cb-6397-4100-9f88-2ca93d4e9485 died, removing from map.
ERROR:root:kernel c76681cb-6397-4100-9f88-2ca93d4e9485 restarted failed!
[W 17:29:29.245 NotebookApp] Kernel deleted before session
[W 17:29:29.245 NotebookApp] 410 DELETE /api/sessions/1a108120-3568-4015-8f65-64a853774b5a (::1) 1.00ms referer=http://localhost:8888/notebooks/Untitled1.ipynb?kernel_name=javascript
[I 17:29:38.240 NotebookApp] Interrupted...
[I 17:29:38.240 NotebookApp] Shutting down kernels

Thanks

UPDATE: Before there was a 404 Error GET Widgets. I ran the command jupyter nbextension enable --py --sys-prefix widgetsnbextension and the output has changed but still doesn't work.

n-riesco commented 8 years ago

@periscuelo I can't reproduce this issue on a linux machine with Jupyter 4.2.0. I'm going to need your help to debug this issue further.

The first thing to try is to rule out this is a problem with the installation of ZMQ. Assuming you installed IJavascript globally, could you uninstall it and install it again. Like this:

$ npm uninstall -g ijavascript
$ npm install -g ijavascript

The above would fix issues caused by an old installation of ZMQ.

If the issue still persists, then we still need to make sure the installation of ZMQ works. If the installation of ZMQ is functional, the following should print out ZMQ is OK:

$ npm i zmq
$ node -e "require('zmq'); console.log('ZMQ is OK');"

If this fails, please, post of the output of running npm version.

Let's assume ZMQ works but IJavascript doesn't. Since Jupyter doesn't show any log messages from IJavascript, let's try to launch the IJavascript kernel manually:

$ jupyter kernelspec list --json
{
  "kernelspecs": {
    "javascript": {
      "resource_dir": "/home/user/.local/share/jupyter/kernels/javascript", 
      "spec": {
        "language": "javascript", 
        "display_name": "Javascript (Node.js)", 
        "env": {}, 
        "argv": [
          "/usr/bin/nodejs", 
          "/home/user/lib/node_modules/ijavascript/lib/kernel.js", 
          "{connection_file}", 
          "--protocol=5.0"
        ]
      }
  }
}

argv tells you how to start an IJavascript:

$ /usr/bin/nodejs /home/user/lib/node_modules/ijavascript/lib/kernel.js {connection_file} --protocol=5.0

where {connection_file} is a path to a connection file. Here's a sample connection file:

{
  "stdin_port": 46041, 
  "ip": "127.0.0.1", 
  "control_port": 54231, 
  "hb_port": 35904, 
  "signature_scheme": "hmac-sha256", 
  "key": "1db6a454-03fe-444a-98ad-93dd9d29d083", 
  "kernel_name": "javascript", 
  "shell_port": 51318, 
  "transport": "tcp", 
  "iopub_port": 40244
}
$ /usr/bin/nodejs /home/user/lib/node_modules/ijavascript/lib/kernel.js /path/to/sample/connection_file.json --protocol=5.0

In this end, this post turned out to be longer than I meant. Please, don't hesitate to ask if any of the instructions need clarification.

periscuelo commented 8 years ago

Sure, no problem.

If this fails, please, post of the output of running npm version.

The console.log didn't print nothing.
npm version 3.10.6

> zmq@2.15.3 install C:\Users\myUser\node_modules\zmq
> node-gyp rebuild

C:\Users\myUser\node_modules\zmq>if not defined npm_config_node_gyp (node "C:\Users\myUser\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild ) 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  binding.cc
  win_delay_load_hook.cc
..\binding.cc(673): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(674): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(675): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(676): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(677): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(678): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(679): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(680): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(681): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(682): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(696): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(697): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(698): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(699): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(700): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(701): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(702): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(703): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(704): warning C4244: 'argument': conversion from 'int64_t' to 'const int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(705): warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(1140): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(1285): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
..\binding.cc(1286): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
c:\users\myUser\node_modules\nan\nan_new.h(208): warning C4244: 'argument': conversion from 'int64_t' to 'double', possible loss of data (compiling source file ..\binding.cc) [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
  ..\binding.cc(624): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::Number,T>(A0)' being compiled
          with
          [
              T=int64_t,
              A0=int64_t
          ]
  ..\binding.cc(678): note: see reference to function template instantiation 'v8::Local<v8::Value> zmq::Socket::GetSockOpt<int64_t>(int)' being compiled
c:\users\myUser\node_modules\nan\nan_new.h(208): warning C4244: 'argument': conversion from 'uint64_t' to 'double', possible loss of data (compiling source file ..\binding.cc) [C:\Users\myUser\node_modules\zmq\build\zmq.vcxproj]
  ..\binding.cc(624): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::Number,T>(A0)' being compiled
          with
          [
              T=uint64_t,
              A0=uint64_t
          ]
  ..\binding.cc(680): note: see reference to function template instantiation 'v8::Local<v8::Value> zmq::Socket::GetSockOpt<uint64_t>(int)' being compiled
     Creating library C:\Users\myUser\node_modules\zmq\build\Release\zmq.lib and object C:\Users\myUser\node_modules\zmq\build\Release\zmq.exp
  Generating code
  Finished generating code
  zmq.vcxproj -> C:\Users\myUser\node_modules\zmq\build\Release\\zmq.node
  zmq.vcxproj -> C:\Users\myUser\node_modules\zmq\build\Release\zmq.pdb (Full PDB)
C:\Users\myUser
`-- zmq@2.15.3 

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\myUser\package.json'
npm WARN myUser No description
npm WARN myUser No repository field.
npm WARN myUser No README data
npm WARN myUser No license field.

Thanks for response.

periscuelo commented 8 years ago

Eureca! It Worked! I will explain how works on windows 10.

  1. In https://github.com/nodejs/node-gyp#installation explain how you can install node-gyp in windows using npm install --global --production windows-build-tools
  2. In prompt, change to folder C:\Users\yourUser\.windows-build-tools\python27
  3. $ npm config set msvs_version 2015
  4. $ npm install node-gyp
  5. $ npm install zmq
  6. $ npm install -g ijavascript
  7. $ jupyter notebook

P.S. If Python 2.7 was not installed by step 1, got to C:\Users\yourUser\.windows-build-tools\ and execute the python installer file.

When i ran the notebook and it worked!

The problem is: you have to install node-gyp and zmq by npm from inside python27 folder. That's because my default python is 3.5 and not 2.7. In my case, Python 2.7 exists only inside python27 folder.

I uninstalled node-gyp, zmq and ijavascript and made the steps 2 - 7 and be happy =)

Thank you very much for the support.

n-riesco commented 7 years ago

The latest release, IJavascrip@5.0.15, uses prebuilt ZMQ bindings and Python 2.7 isn't required.