[solve]Jupyterlab無法啟動from remote ssh access

王柏鈞
機器學習歷程
Published in
Nov 22, 2022

--

socket.gaierror: [Errno -5] No address associated with hostname

錯誤訊息

問題出在遠端連線回主機時,hostname不是localhost,而預設的jupyterlab沒有開啟遠端功能。

solve: (jupyterlab 0.33.12) 把下面的命令貼在linux的terminal然後執行。

echo yes | jupyter notebook --generate-config
defaultPath="${HOME}/.jupyter/jupyter_notebook_config.py"
sed -i -e '82c c.NotebookApp.allow_remote_access = True' "$defaultPath"
sed -i -e '204c c.NotebookApp.ip = "*"' "$defaultPath"
sed -i -e '267c c.NotebookApp.open_browser = False' "$defaultPath"
sed -i -e '287c c.NotebookApp.port = 8888' "$defaultPath"

接下來可能要設置密碼

設定密碼
jupyter notebook password

設置好以後正常啟動即可

jupyter lab

--

--