본문 바로가기
IT, Software/Python

Jupyter Lab 에서 Plotly 그래프 미노출 현상

by 기타마을이장 2020. 10. 19.

지난 데이터분석중에 사용했던 툴은 Jupyter Notebook이었다.

그리고 아무 문제 없이 데이터가공부터 분석, kmean clustering, 시각화까지 원활하게 진행이 가능했다.

그런데 좀 더 풍부한 UI를 활용해서 이후 진행을 하고 싶어 Jupyter Lab으로 툴을 변경하기로 했다.

물론 머 크게 차이가 있는건 아니지만, 좀 더 IDE스러워서 정도가 이유다.(지극히 개인적인 의견)

Jupyter Lab 사용하기

Anaconda는 사실 Jupyer Notebook, Jupyter Lab을 모두 그냥 제공하기 때문에 크게 어려움은 없다.

Anaconda Prompt에서 실행하면 바로 실행된다.

(base) G:\> jupyter lab

[I 10:51:15.143 LabApp] JupyterLab extension loaded from D:\Python\Anaconda3\lib\site-packages\jupyterlab
[I 10:51:15.143 LabApp] JupyterLab application directory is D:\Python\Anaconda3\share\jupyter\lab
[I 10:51:15.155 LabApp] Serving notebooks from local directory: G:\
[I 10:51:15.155 LabApp] The Jupyter Notebook is running at:
[I 10:51:15.156 LabApp] http://localhost:8888/?token=9e809b4fc03e2805e63c195ab3eff77e61db3779bc4c5893
[I 10:51:15.157 LabApp]  or http://127.0.0.1:8888/?token=9e809b4fc03e2805e63c195ab3eff77e61db3779bc4c5893
[I 10:51:15.158 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:51:15.321 LabApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/FidelisLee/AppData/Roaming/jupyter/runtime/nbserver-23628-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=9e809b4fc03e2805e63c195ab3eff77e61db3779bc4c5893
     or http://127.0.0.1:8888/?token=9e809b4fc03e2805e63c195ab3eff77e61db3779bc4c5893

그리고 나서 브라우저에서 http://localhost:8888 을 입력해보면 Jupyter Lab이 뜨는 것을 확인할 수 있다.

기존에 Jupyter Notebook으로 작성해둔 코드들도 물론 그대로 로딩된다.

기본 테마는 White이지만 선호하는 조금이라도 눈의 피로를 줄이고자 Dark테마로 변경했다.

사실 이 Dark테마때문에 갈아탄게 결정적인 이유이기도 하다.

(체감상이지만 Notebook보다 살짝 더 무거운 것 같기도 하다)

Jupyter Lab Plotly 그래프 미노출 현상 해결

기분좋게 새로운 툴을 사용해보려는 했는데...

엇;; 기존에 Notebook에서는 잘 나오던 Plotly 그래프가 안나온다;;;;

아래 그림처럼(퍼온 스샷임)

 

Jupyter labextension 설치

그래서 열심히 구글링을 해본다.

그리고 plotly 사이트에 Trouble Shooting Guide가 있다고 하여 참조해서 진행해봤다.

https://plotly.com/python/getting-started/

 

Getting Started with Plotly

Getting Started with Plotly for Python.

plotly.com

Anaconda에서 Jupyter labextension 설치하기

(base) G:\> jupyter labextension uninstall jupyterlab-plotly
An error occured.
ValueError: 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).
See the log file for details:  C:\Users\FIDELI~1\AppData\Local\Temp\jupyterlab-debug-tcvh51e0.log

그런데 이번엔 Anaconda환경에서 작업하는 나에게 새로운 과제가 주어졌다.

Node.js가 없다는 에러가 발생;; 이걸 먼저 해결해야한다. 그래서 다시 구글링을 해본다.

답은 다행히 아나콘다 사이트를 통해서 바로 확인할 수 있었다ㅎㅎ

anaconda.org/conda-forge/nodejs

 

Nodejs :: Anaconda Cloud

a platform for easily building fast, scalable network applications

anaconda.org

(base) G:\> conda install -c conda-forge nodejs

위 커맨드를 입력했더니 조금 뒤 설치가 완료됐다.

그리고 다시 Plotly 사이트내 가이드대로 수행하니 진행이 된다.

다만 엄청 시간이 오래 걸린다;;;

완료되고나면 Jupyter Lab을 재시작한다...

그리고 드디어 그래프가 보인다ㅎㅎㅎ

역시...쉽게 되는게 잘 없는거 같다ㅠ

반응형

댓글