JupyterLab에서 node.js 커널이 서 있지 않습니다.

같은 상황에 서있는 사람이 과연 존재하는지 모르기 때문에 잡담

환경:
win10
아나콘다 4.8.3

발생한 문제



node.js의 커널이 서 있지 않습니다.
>jupyter lab
[I 19:33:43.066 LabApp] JupyterLab extension loaded from C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab
[I 19:33:43.066 LabApp] JupyterLab application directory is C:\ProgramData\Anaconda3\share\jupyter\lab
[I 19:33:43.486 LabApp] Serving notebooks from local directory: C:\Users\fuga
[I 19:33:43.487 LabApp] The Jupyter Notebook is running at:
[I 19:33:43.487 LabApp] http://localhost:8888/
[I 19:33:43.487 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 19:33:45.892 LabApp] 301 GET /lab/workspaces/auto-Z/?clone (::1) 1.01ms
[I 19:33:47.494 LabApp] Build is up to date
[I 19:33:49.648 LabApp] Creating new notebook in /
[E 19:33:50.113 LabApp] Failed to run command:
    ['ijskernel.cmd', '--hide-undefined', 'C:\\Users\\hoge\\AppData\\Roaming\\jupyter\\runtime\\kernel-6cf3f0a8-3fed-475d-b293-b37723c04594.json', '--protocol=5.0']

당연히 코드를 실행할 수 없습니다.
[E 19:33:52.012 LabApp] Uncaught exception POST /api/sessions?1590748431976 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/sessions?1590748431976', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\web.py", line 1703, in _execute
        result = await result
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
        yielded = self.gen.throw(*exc_info)  # type: ignore
      File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
        type=mtype))
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
        value = future.result()
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
        yielded = self.gen.throw(*exc_info)  # type: ignore
      File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
        kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
        value = future.result()
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
        yielded = self.gen.throw(*exc_info)  # type: ignore
      File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
        self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
        value = future.result()
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
        yielded = next(result)
      File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
        super(MappingKernelManager, self).start_kernel(**kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 158, in start_kernel
        km.start_kernel(**kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 305, in start_kernel
        self.kernel = self._launch_kernel(kernel_cmd, **kw)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 212, in _launch_kernel
        return launch_kernel(kernel_cmd, **kw)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\launcher.py", line 135, in launch_kernel
        proc = Popen(cmd, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1207, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。

치료하기 전에 시도한 것



1. 일단 node가 들어 있는지 확인


>conda install nodejs
>conda update -all

2. kernel.json을 다시 만들어 봅니다.


>npm install -g ijavascript
>ijsinstall
>jupyter kernelspec list
Available kernels:
  javascript    C:\Users\hoge\AppData\Roaming\jupyter\kernels\javascript
  python3       C:\ProgramData\Anaconda3\share\jupyter\kernels\python3

괜찮아

3. 여기서 jupyter lab을 다시 시작하면 오류가 보이게 되었다



오류 내용↓
Error: The module '\\?\C:\Program Files (x86)\Nodist\bin\node_modules\ijavascript\node_modules\zeromq\build\Release\zmq.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 67. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:846:18)
    at Module.load (internal/modules/cjs/loader.js:672:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:612:12)
    at Function.Module._load (internal/modules/cjs/loader.js:604:3)
    at Module.require (internal/modules/cjs/loader.js:711:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (C:\Program Files (x86)\Nodist\bin\node_modules\ijavascript\node_modules\zeromq\lib\index.js:6:11)
    at Module._compile (internal/modules/cjs/loader.js:805:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
    at Module.load (internal/modules/cjs/loader.js:672:32)
[I 19:38:54.040 LabApp] KernelRestarter: restarting kernel (4/5), new random ports
internal/modules/cjs/loader.js:846
  return process.dlopen(module, path.toNamespacedPath(filename));

분명히 nodejs의 버전이 다르다고 말해지고 있다.
그러고 보니 업데이트한 것 같다.
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 67. Please try re-compiling or re-installing

NODE_MODULE_VERSION이 67이지만 64를 원합니다.

4. nodejs 버전 변경



출시 목록 | Node.js
여기를 보러 NODE_MODULE_VERSION이 64의 것을 선택한다.
나는 어쨌든 10.12.0으로하기로 결정했다.
버전 변경에는 이미 넣어 있던 nodist를 사용했다.
>nodist 10.12.0
10.12.0
Installing 10.12.0
 10.12.0 [===============] 24201/24201 KiB 100% 0.0s
Installation successful.

>nodist
  (x64)
  8.16.2
> 10.12.0  (global: 10.12.0)
  11.13.0

5. 뭐라고 하는 리빌드를 한다.


>jupyter lab build
[LabBuildApp] JupyterLab 1.2.6
[LabBuildApp] Building in C:\ProgramData\Anaconda3\share\jupyter\lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
-

성공했다고도 실패했다고도 나오지 않지만, 아마 성공하고 있다.

6. jupyter lab 시작하기


>jupyter lab

안전하게 실행할 수 있었다!

좋은 웹페이지 즐겨찾기