升級到j(luò)upyter lab 3之后原來的password無法登陸解決方法

  1. jupyter-lab 2使用jupyter_notebook_config.py配置文件進行密碼設(shè)置的操作為:

/opt/pyenvs/envtf22/bin/ipython

Python 3.6.8 (default, Nov 16 2020, 16:55:22)

Type 'copyright', 'credits' or 'license' for more information

IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [3]: from notebook.auth import passwd; passwd("heheda")

Out[3]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$Ktjc9LqcZ7WxFPcjp8SFlQ$oKAMhUstb80LAsEFROzD9A'

vim jupyter_notebook_config.py

# 將 c.NotebookApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$Ktjc9LqcZ7WxFPcjp8SFlQ$oKAMhUstb80LAsEFROzD9A'
# 加入jupyter_notebook_config.py中

# 啟動jupyter-lab

nohup /opt/pyenvs/envtf22/bin/jupyter-lab --config='./jupyter/jupyter_notebook_config.py' &>./jupyter_lab_log.txt &

  1. 當升級到j(luò)upyter-lab3之后,發(fā)現(xiàn)使用原來的jupyter_notebook_config.py配置文件進行啟動時會有一些告警,并且使用密碼無法登陸,同時又沒有token在啟動日志中打印。

[W 2021-03-03 13:16:31.025 LabApp] 'allow_root' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.

[W 2021-03-03 13:16:31.026 LabApp] 'ip' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.

[W 2021-03-03 13:16:31.026 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.

[W 2021-03-03 13:16:31.026 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.

[W 2021-03-03 13:16:31.026 LabApp] 'password' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.

[W 2021-03-03 13:16:31.026 LabApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.

[W 2021-03-03 13:16:31.037 ServerApp] notebook_dir is deprecated, use root_dir

[I 2021-03-03 13:16:31.037 ServerApp] jupyterlab | extension was successfully linked.

[I 2021-03-03 13:16:31.500 ServerApp] nbclassic | extension was successfully linked.

[W 2021-03-03 13:16:31.542 ServerApp] WARNING: The Jupyter server is listening on all IP addresses and not using encryption. This is not recommended.

[I 2021-03-03 13:16:31.549 LabApp] JupyterLab extension loaded from /opt/pyenvs/envtf22/lib/python3.6/site-packages/jupyterlab

[I 2021-03-03 13:16:31.549 LabApp] JupyterLab application directory is /opt/pyenvs/envtf22/share/jupyter/lab

[I 2021-03-03 13:16:31.555 ServerApp] jupyterlab | extension was successfully loaded.

[I 2021-03-03 13:16:31.561 ServerApp] nbclassic | extension was successfully loaded.

[I 2021-03-03 13:16:31.561 ServerApp] 啟動notebooks 在本地路徑: /home

[I 2021-03-03 13:16:31.562 ServerApp] Jupyter Server 1.4.1 is running at:

[I 2021-03-03 13:16:31.562 ServerApp] http://bg1:1288/lab

[I 2021-03-03 13:16:31.562 ServerApp]  or http://127.0.0.1:1288/lab

[I 2021-03-03 13:16:31.562 ServerApp] 使用control-c停止此服務(wù)器并關(guān)閉所有內(nèi)核(兩次跳過確認).

[W 2021-03-03 13:16:31.570 ServerApp] 沒有找到web瀏覽器: could not locate runnable browser.

[I 2021-03-03 13:16:48.118 LabApp] 302 GET /lab (192.168.10.97) 2.26ms

[W 2021-03-03 13:16:51.500 ServerApp] 401 POST /login?next=%2Flab (192.168.10.97) 3.18ms referer=http://192.168.0.15:1288/login?next=%2Flab

[W 2021-03-03 13:17:08.944 ServerApp] 401 POST /login?next=%2Flab (192.168.10.97) 3.24ms referer=http://192.168.0.15:1288/login?next=%2Flab

image
  1. 解決方法

# 將配置文件中使用到的.NotebookApp修改為.ServerApp,如:

# 將 c.NotebookApp.open_browser = False 修改為:

c.ServerApp.open_browser = False

  1. 這只能解決告警問題,永久修改密碼并保存到配置文件中,還需要繼續(xù)以下操作:

# shell中輸入jupyter-lab password,設(shè)置jupyter-lab密碼

jupyter-lab password

image

cat /root/.jupyter/jupyter_server_config.json

{

  "ServerApp": {

    "password": "sha1:7f28388e8a7b:ebc342bc6d7eefed08912d7edf6d364751c97c41"

  }

}

將 c.ServerApp.password = "sha1:7f28388e8a7b:ebc342bc6d7eefed08912d7edf6d364751c97c41"
替換jupyter_notebook_config.py中原來的密碼配置。

  1. 啟動jupyter-lab3
nohup /opt/pyenvs/envtf22/bin/jupyter-lab --config='./jupyter/jupyter_notebook_config.py' &>./jupyter_lab_log.txt &
  1. 查看啟動日志
tail -100 ./jupyter_lab_log.txt

[W 2021-03-03 13:02:01.421 ServerApp] notebook_dir is deprecated, use root_dir
[I 2021-03-03 13:02:01.454 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-03-03 13:02:01.904 ServerApp] nbclassic | extension was successfully linked.
[W 2021-03-03 13:02:01.947 ServerApp] WARNING: The Jupyter server is listening on all IP addresses and not using encryption. This is not recommended.
[I 2021-03-03 13:02:01.953 LabApp] JupyterLab extension loaded from /opt/pyenvs/envtf22/lib/python3.6/site-packages/jupyterlab
[I 2021-03-03 13:02:01.953 LabApp] JupyterLab application directory is /opt/pyenvs/envtf22/share/jupyter/lab
[I 2021-03-03 13:02:01.960 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-03-03 13:02:01.967 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-03-03 13:02:01.967 ServerApp] 啟動notebooks 在本地路徑: /home
[I 2021-03-03 13:02:01.967 ServerApp] Jupyter Server 1.4.1 is running at:
[I 2021-03-03 13:02:01.967 ServerApp] http://bg1:1207/lab
[I 2021-03-03 13:02:01.967 ServerApp]  or http://127.0.0.1:1207/lab
[I 2021-03-03 13:02:01.967 ServerApp] 使用control-c停止此服務(wù)器并關(guān)閉所有內(nèi)核(兩次跳過確認).
[W 2021-03-03 13:02:01.976 ServerApp] 沒有找到web瀏覽器: could not locate runnable browser.
[I 2021-03-03 13:02:10.521 ServerApp] 302 POST /login?next=%2Flab%3F (192.168.10.97) 5.75ms
[I 2021-03-03 13:02:15.620 LabApp] Build is up to date
[I 2021-03-03 13:02:47.500 ServerApp] Kernel started: 368e649f-5429-476b-a21c-f03521d55c29
[I 2021-03-03 13:03:35.396 LabApp] 302 GET /lab (192.168.10.97) 1.97ms
[I 2021-03-03 13:03:42.776 ServerApp] 302 POST /login?next=%2Flab (192.168.10.97) 3.18ms
[I 2021-03-03 13:03:47.905 LabApp] Build is up to date
[I 2021-03-03 13:44:04.531 ServerApp] Starting buffering for 368e649f-5429-476b-a21c-f03521d55c29:dd931da2-18ce-43f4-96c3-03fffdba796a
[I 2021-03-03 13:44:08.759 LabApp] Build is up to date

image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容