갈루아의 반서재

 

Extension Manager를 통한 텐서보드 설치

주피터랩을 실행한 후 좌측 Extension Manager 를 선택한 후 검색창에 tensorboard 라고 검색한다. 검색 결과 중 jupyterlab_tensorboard 항목을 설치한 후 Install 을 클릭한다.

 

Extension Installation Error - Node.js 와 npm 설치 (Ubuntu 저장소)

하지만, Extension Installation Error 이 발생한다. Node.js 와 npm 을 먼저 설치하라고 한다.

[W 2020-12-28 15:29:17.570 LabApp] Could not determine jupyterlab build status without nodejs

Extension Installation Error
An error occurred installing <code>jupyterlab_tensorboard</code>.

Error message:
Please install Node.js and npm before continuing installation. You may be able to install Node.js from your package manager, from conda, or directly from the Node.js website (https://nodejs.org).

그러면 Node.js 와 npm 을 설치해보자. Ubuntu 20.04 는 기본 저장소에 Node.js 를 포함하고 있다. 작성 시점 현재 최신 버전은 10.19 이다. 먼저 apt 패키지 매니저를 사용해야 하므로, 다음과 같이 로컬 패키지 인덱스부터 리프레쉬시킨다.

(pluto) fossa@fossa:~$ sudo apt update

그리고 나서 Node.js 를 설치한다.

(pluto) fossa@fossa:~$ sudo apt install nodejs

버전 출력을 통해 설치가 제대로 되었는지 확인한다.

(pluto) fossa@fossa:~$ nodejs -v
v10.19.0

대부분의 경우 Node.js 패키지매니저 npm 설치도 필요하므로 다음과 같이 apt 를 통해 npm 패키지를 설치한다. Node.js 사용에 필요한 모듈과 패키지를 설치가가 끝났다. 

(pluto) fossa@fossa:~$ sudo apt install npm

다시 jupyterlab_tensorboard 을 설치해보자. 하지만 필요한 node.js 버전이 12.0.0 이상이다. Ubutu 저장소를 통해 설치한 버전은 10.19.0 으로 직접 node.js 웹사이트에서 설치를 해야한다. 

 

Extension Installation Error - PPA 를 통한 최신 버전 Node.js 설치

다른 버전(이 경우 최신버전)의 Node.js 를 설치하기 위해서는 NodeSource 가 유지관리하는 PPA (personal package archive) 를 사용할 수 있다. 이러한 PPAs 는 공식 우분투 저장소에서 사용할 수 있는 것보다 더욱 다양한 버전의 Node.js 를 사용할 수 있다. Node.js v10, v12, v13, v14, v15 가 현재 사용가능하다.

 

먼저 패키지에 접근하기 위해 PPA 부터 설치하자. 홈 디렉토리로 이동하여 curl 명령을 이용하여 원하는 버전의 설치 스크립트를 가져온다. 

(pluto) fossa@fossa:~$ cd ~
(pluto) fossa@fossa:~$ pwd
/home/fossa
(pluto) fossa@fossa:~$ curl -sL https://deb.nodesource.com/setup_current.x | sudo -E bash -

설치 스크립트를 실행한다.

(pluto) fossa@fossa:~$ sudo apt-get install -y nodejs

더욱 자세한 내용은 NodeSource documentation 를 참고한다. 설치된 Node.js 의 버전을 확인해보자. v15.5.0 으로 앞선 에러의 원인이었던 v.12.0 을 넘는 최신버전이 설치되었음을 알 수 있다.

(pluto) fossa@fossa:~$ node -v
v15.5.0

 

Extension Installation Error - jupyterLab 다운그레이드

하지만 다른 에러가 발생했다. 이제는 jupyterlab_tensorboard 가 현재 버전의 JupyterLab 을 지원하지 않는다고 한다. 헐. 

현재 JupyterLab 버전은 다음과 같다. 3.0.0 이다. 에러메시지에서 보듯이 3.0.0 미만이어야 한다. ChangeLog 는 여기서 확인한 후 이전 버전의 주피터랩을 설치하자.

(pluto) fossa@fossa:~$ jupyter-lab --version
3.0.0

2.2 버전을 설치하면 되겠다.

(pluto) fossa@fossa:~$ conda install -c conda-forge jupyterlab=2.2
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.2
  latest version: 4.9.2

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /home/fossa/anaconda3/envs/pluto

  added / updated specs:
    - jupyterlab=2.2


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    jupyterlab-2.2.9           |             py_0         5.9 MB  conda-forge
    jupyterlab_server-1.2.0    |             py_0          25 KB
    ------------------------------------------------------------
                                           Total:         6.0 MB

The following packages will be UPDATED:

  ca-certificates    anaconda::ca-certificates-2020.10.14-0 --> conda-forge::ca-certificates-2020.12.5-ha878542_0
  certifi                anaconda::certifi-2020.6.20-py38_0 --> conda-forge::certifi-2020.12.5-py38h578d9bd_0
  openssl               anaconda::openssl-1.1.1h-h7b6447c_0 --> pkgs/main::openssl-1.1.1i-h27cfd23_0

The following packages will be SUPERSEDED by a higher-priority channel:

  jupyterlab_server  conda-forge::jupyterlab_server-2.0.0-~ --> pkgs/main::jupyterlab_server-1.2.0-py_0

The following packages will be DOWNGRADED:

  jupyterlab                             3.0.0-pyhd8ed1ab_0 --> 2.2.9-py_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
jupyterlab_server-1. | 25 KB     | ##################################### | 100%
jupyterlab-2.2.9     | 5.9 MB    | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(pluto) fossa@fossa:~$

 

Launcher Error - Invalid response : 500 Internal Server Error 발생

주피터랩 2.2.0 버전 설치가 끝났다. 다시 jupyterlab_tensorboard를 설치해보자. 설치를 누르면 다음과 같이 "a build is needed to include the latest changes" 라는 메시지가 뜬다. "Rebuild"를 선택한다.

빌드가 끝났고, 페이지를 리로딩한다.

정상적으로 jupyterlab_tensorboard 설치가 끝났다.

File > New > Tensorboard 를 선택해서 텐서보드를 구동해보자.

하지만 다음과 같이 Launcher Error Invalid response : 500 Internal Server Error 가 발생했다.

여기에서 확인할 수 있듯이 위 에러는 최근의 텐서플로 리팩토링과 관련된 것으로 TensorBoardWSGI 제거와 관계가 있다고 한다. 지금 조치할 수 있는 가장 간단한 방법은 텐서보드를 이전 버전으로 설치하는 것이다. TensorBoardWSGI 가 가능한 최신 버전은 2.2 이므로 다음과 같이 2.2 버전을 설치한다. 현재는 2.4 버전이 설치되어 있다.

(pluto) fossa@fossa:~$ tensorboard --version
2.4.0
(pluto) fossa@fossa:~$ pip install tensorboard==2.2
Installing collected packages: tensorboard
  Attempting uninstall: tensorboard
    Found existing installation: tensorboard 2.4.0
    Uninstalling tensorboard-2.4.0:
      Successfully uninstalled tensorboard-2.4.0
ERROR: pip dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-cpu 2.4.0 requires tensorboard~=2.4, but you have tensorboard 2.2.0 which is incompatible.
Successfully installed tensorboard-2.2.0
(pluto) fossa@fossa:~$

2.2 버전이 설치되었다. 하지만 위에서 보듯이 텐서플로우 역시 하위 버전으로 다운그레이드가 필요하다. 

(pluto) fossa@fossa:~$ tensorboard --version
2.2.0

현재 텐서플로 버전은 2.4 이다. 

(pluto) fossa@fossa:~$ python3 -c 'import tensorflow as tf; print(tf.__version__)'
2.4.0

텐서플로 버전 릴리스 정보를 확인하여 2.2.1 버전으로 설치하자. 

(pluto) fossa@fossa:~$ pip install tensorflow-cpu==2.2.1
Collecting tensorflow-estimator<2.3.0,>=2.2.0
  Using cached tensorflow_estimator-2.2.0-py2.py3-none-any.whl (454 kB)
Installing collected packages: numpy, tensorflow-estimator, tensorflow-cpu
  Attempting uninstall: numpy
    Found existing installation: numpy 1.19.4
    Uninstalling numpy-1.19.4:
      Successfully uninstalled numpy-1.19.4
  Attempting uninstall: tensorflow-estimator
    Found existing installation: tensorflow-estimator 2.4.0
    Uninstalling tensorflow-estimator-2.4.0:
      Successfully uninstalled tensorflow-estimator-2.4.0
  Attempting uninstall: tensorflow-cpu
    Found existing installation: tensorflow-cpu 2.4.0
    Uninstalling tensorflow-cpu-2.4.0:
      Successfully uninstalled tensorflow-cpu-2.4.0
Successfully installed numpy-1.19.2 tensorflow-cpu-2.2.1 tensorflow-estimator-2.2.0

텐서플로 2.2.1 버전 설치가 끝났다.

(pluto) fossa@fossa:~$ python3 -c 'import tensorflow as tf; print(tf.__version__)'
2.2.1

텐서보드가 정상 작동함을 이제 확인할 수 있다.