[Error] JupyterLab 위젯 로드 에러 + jupyter lab build 오류

·

2 min read

🔍 에러 내용 1 : JupyterLab 위젯 로드 에러

Failed to load model class 'HBoxModel' from module '@jupyter-widgets/controls'  
Error: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however, 2.0.0 is

주요 원인:

  • @jupyter-widgets/controls의 버전 불일치로 인해 HBoxModel 위젯을 로드하는 데 실패.

  • @jupyter-widgets/controls에서 요구하는 버전은 ^1.5.0인데, 설치된 버전은 2.0.0.

  • 이는 JupyterLab에서 위젯을 사용하거나, 진행 상태(progress bar)를 시각화하는 데 필요한 패키지.

🛠️ 해결 방법

1. ipywidgetsjupyterlab-widgets 재설치

pip install ipywidgets==7.7.2
pip install jupyterlab-widgets==1.1.1

2. JupyterLab 확장 프로그램 재설치

jupyter labextension install @jupyter-widgets/jupyterlab-manager@2.0.0

3. JupyterLab 재시작 및 빌드

jupyter lab build
jupyter lab
  • 빌드 후 JupyterLab을 재시작하여 정상 작동 여부를 확인.

🔍에러 내용 2 : JupyterLab 빌드 오류

Troubleshooting: If the build failed due to an out-of-memory error, you
may be able to fix it by disabling the `dev_build` and/or `minimize` options.

If you are building via the `jupyter lab build` command, you can disable
these options like so:

jupyter lab build --dev-build=False --minimize=False

You can also disable these options for all JupyterLab builds by adding these
lines to a Jupyter config file named `jupyter_config.py`:

c.LabBuildApp.minimize = False
c.LabBuildApp.dev_build = False

If you don't already have a `jupyter_config.py` file, you can create one by
adding a blank file of that name to any of the Jupyter config directories.
The config directories can be listed by running:

jupyter --paths

Explanation:

- `dev-build`: This option controls whether a `dev` or a more streamlined
`production` build is used. This option will default to `False` (i.e., the
`production` build) for most users. However, if you have any labextensions
installed from local files, this option will instead default to `True`.
Explicitly setting `dev-build` to `False` will ensure that the `production`
build is used in all circumstances.

- `minimize`: This option controls whether your JS bundle is minified
during the Webpack build, which helps to improve JupyterLab's overall
performance. However, the minifier plugin used by Webpack is very memory
intensive, so turning it off may help the build finish successfully in
low-memory environments.

주요 원인:

  • 환경에 nodejs가 안 깔림

🛠️ 해결 방법

  • 환경에 nodejs와 npm 설치

    • conda 환경

        conda install -c conda-forge nodejs
      
    • Ubuntu/Debian

        sudo apt update
        sudo apt install nodejs npm
      
  • 설치 후, 버전 확인

      node -v
      npm -v
    
  • 재빌드

      jupyter lab build