DonJayamanne / typescript-notebook

Run JavaScript and TypeScript in node.js within VS Code notebooks with excellent support for debugging, tensorflowjs visulizations, plotly, danfojs, etc
https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook
MIT License
905 stars 40 forks source link

Cannot connect to kernel on Ubuntu [Solved] #17

Closed sahin52 closed 3 years ago

sahin52 commented 3 years ago

I solved the issue but I will share here just to let you know.
I couldn't run a cell after changing its language to Typescript. The logs of Jupyter was like this:

Error 2021-08-09 13:47:39: Failed to execute cells in CellExecutionQueue c [Error]: Kernel  is not usable. Check the Jupyter output tab for more information.
    at r (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/extension.js:24:124325)
    at i (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/extension.js:24:124455)
    at o (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:1:57940)
    at Object.e.emit (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:1:57654)
    at e.emit (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:1:55891)
    at c.dispose (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:3:540979)
    at /home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:3:545415
    at Object.t.each (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:1:63059)
    at m (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:3:545331)
    at /home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:3:544210
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at t.SessionManager.requestRunning (/home/sahin/.vscode/extensions/ms-toolsai.jupyter-2021.8.1195043623/out/client/node_modules/@jupyterlab/services.js:3:537701) {
  category: 'invalidkernel',
  kernelConnectionMetadata: {
    kernelModel: {
      _createSocket: [Function (anonymous)],
      _onWSOpen: [Function (anonymous)],
      _onWSMessage: [Function (anonymous)],
      _onWSClose: [Function (anonymous)],
      _id: '815b79b7-0955-4497-a926-6a073e83c673',
      _name: 'javascript',
      _status: 'dead',
      _kernelSession: '',
      _clientId: 'abf47e06-1521-4ab1-ba38-fbfb3c85e4ef',
      _isDisposed: true,
      _wsStopped: true,
      _ws: null,
      _username: '',
      _reconnectLimit: 7,
      _reconnectAttempt: 0,
      _isReady: false,
      _readyPromise: [e],
      _initialized: false,
      _futures: Map(0) {},
      _comms: Map(0) {},
      _targetRegistry: [Object: null prototype] {},
      _info: null,
      _pendingMessages: [],
      _statusChanged: [e],
      _iopubMessage: [e],
      _anyMessage: [e],
      _unhandledMessage: [e],
      _displayIdToParentIds: Map(0) {},
      _msgIdToDisplayIds: Map(0) {},
      _terminated: [e],
      _msgChain: null,
      _noOp: [Function (anonymous)],
      serverSettings: [Object],
      handleComms: true,
      lastActivityTime: 2021-08-09T10:47:39.533Z,
      numberOfConnections: 0,
      session: [Object]
    },
    kind: 'connectToLiveKernel',
    id: undefined
  },
  vslsStack: [
    CallSite {}, CallSite {},
    CallSite {}, CallSite {},
    CallSite {}, CallSite {},
    CallSite {}, CallSite {},
    CallSite {}, CallSite {},
    CallSite {}, CallSite {},
    CallSite {}
  ]
}
Info 2021-08-09 13:47:39: Cancel pending cells
Info 2021-08-09 13:47:39: Cell Index:0, state:2, exec: undefined. Execution cancelled
Info 2021-08-09 13:47:39: Cell Index:0, state:2, exec: undefined. Completed due to cancellation
Info 2021-08-09 13:47:39: Cell Index:0, state:2, exec: undefined. Cell cancelled & resolving
Info 2021-08-09 13:47:39: Cell Index:0, state:2, exec: undefined. Execution disposed
Info 2021-08-09 13:47:39: Process Execution: > /usr/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /usr/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
Info 2021-08-09 13:47:39: Process Execution: > /usr/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> /usr/bin/python3 -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v

I tried to run Typescript on a blank Jupyter-notebook, on the browser, and I realized that it wasn't working there either.
So I decided to install tslab from https://github.com/yunabe/tslab#installing-tslab-1

For a fast installation you can copy paste:

npm install -g tslab
tslab install --version # see if it is installed
tslab install --python=python3 # register with python3
jupyter kernelspec list # see if typescript exists

After installing tslab, the jupyter with typescript on vs code worked. Thanks