簡體   English   中英

將Jupyter Lab與tmpnb一起使用

[英]Using Jupyter Lab with tmpnb

我正在嘗試通過tmpnb使用JupyterLab

我想產生許多JupyterLab實例,就像tmpnb為Jupyter Notebook所做的那樣。

我已經通過docker build -t jupyterlab2 .創建了一個新的docker build -t jupyterlab2 . 使用以下Dockerfile的命令:

FROM jupyter/datascience-notebook
MAINTAINER apr
RUN pip install npm
RUN pip install jupyterlab
RUN jupyter serverextension enable --py jupyterlab

之后,我運行以下命令:

export TOKEN=$( head -c 30 /dev/urandom | xxd -p )

docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=proxy jupyter/configurable-http-proxy --default-target http://127.0.0.1:9999

docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=tmpnb -v /var/run/docker.sock:/docker.sock jupyter/tmpnb python orchestrate.py --allow_origin='*' --image='jupyterlab2' --pool-size=5 --container-user=root  --command='jupyter lab --allow-root LabApp.allow_origin="*"'

當我訪問URL http://<ip-address>:8000 ,我被重定向到http://<ip>:8000/user/sTVKGwH01uoQ ,但這顯示404。我也嘗試訪問http://<ip>:8000/user/sTVKGwH01uoQ/lab但這也給出了404。

以下是1個實例的日志:

Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Execute the command: jupyter lab --allow-root --port 8888 --ip=0.0.0.0 --LabApp.allow_origin=*
[I 09:05:52.598 LabApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 09:05:54.689 LabApp] JupyterLab alpha preview extension loaded from /opt/conda/lib/python3.6/site-packages/jupyterlab
[I 09:05:54.694 LabApp] Serving notebooks from local directory: /home/jovyan
[I 09:05:54.694 LabApp] 0 active kernels
[I 09:05:54.694 LabApp] The Jupyter Notebook is running at:
[I 09:05:54.694 LabApp] http://0.0.0.0:8888/?token=584fc5114d037ad23296ca8284ea1074b220d058018cb2c4
[I 09:05:54.694 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:05:54.695 LabApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://0.0.0.0:8888/?token=584fc5114d037ad23296ca8284ea1074b220d058018cb2c4
[I 09:05:57.142 LabApp] 302 GET /user/1BhE9UZ2gg5o/ (172.17.0.1) 0.54ms
[W 09:05:57.144 LabApp] 404 GET /user/1BhE9UZ2gg5o (172.17.0.1) 1.45ms referer=None
[I 09:05:57.347 LabApp] 302 GET /user/1BhE9UZ2gg5o/ (172.17.0.1) 0.56ms
[W 09:05:57.350 LabApp] 404 GET /user/1BhE9UZ2gg5o (172.17.0.1) 1.44ms referer=None
[I 09:05:57.553 LabApp] 302 GET /user/1BhE9UZ2gg5o/ (172.17.0.1) 0.55ms
[W 09:05:57.556 LabApp] 404 GET /user/1BhE9UZ2gg5o (172.17.0.1) 1.41ms referer=None
[I 09:05:57.767 LabApp] 302 GET /user/1BhE9UZ2gg5o/ (172.17.0.1) 2.80ms
[W 09:05:57.773 LabApp] 404 GET /user/1BhE9UZ2gg5o (172.17.0.1) 3.44ms referer=None
[I 09:05:57.978 LabApp] 302 GET /user/1BhE9UZ2gg5o/ (172.17.0.1) 0.56ms
[W 09:05:57.981 LabApp] 404 GET /user/1BhE9UZ2gg5o (172.17.0.1) 1.46ms referer=None
[I 09:05:58.184 LabApp] 302 GET /user/1BhE9UZ2gg5o/ (172.17.0.1) 0.55ms
[W 09:05:58.187 LabApp] 404 GET /user/1BhE9UZ2gg5o (172.17.0.1) 1.42ms referer=None
[I 09:05:58.391 LabApp] 302 GET /user/1BhE9UZ2gg5o/ (172.17.0.1) 0.56ms
[W 09:05:58.394 LabApp] 404 GET /user/1BhE9UZ2gg5o (172.17.0.1) 2.05ms referer=None
[W 09:06:18.518 LabApp] 404 GET /user/1BhE9UZ2gg5o/tree (172.17.0.1) 1.61ms referer=http://52.71.15.52:8000/
[W 09:06:27.502 LabApp] 404 GET /user/1BhE9UZ2gg5o/lab (172.17.0.1) 2.51ms referer=None
[W 09:07:20.568 LabApp] 404 GET /user/1BhE9UZ2gg5o/lab (172.17.0.1) 2.28ms referer=None

我看了一個與JupyterHub有關的問題 ,看起來很相似。 404錯誤頁面對我來說也一樣。 我也用start.sh嘗試了一些隨機的東西,但是沒有運氣。

甚至可以使用tmpnb運行JupyterLab嗎? 如果沒有,那么我可以使用哪些其他工具來達到相同的目的?

必須設置基本URL,否則/user/...路由將不會映射到正確的東西。 這是tmpnb README中所有示例命令中的--NotebookApp.base_url --NotebookApp.base_url={base_path}部分。 這些看起來像:

python orchestrate.py --command='jupyter notebook --no-browser \
    --port {port} --ip=0.0.0.0 --NotebookApp.base_url={base_path} \
    --NotebookApp.port_retries=0'

因此,JupyterLab等效項將是:

python orchestrate.py --command='jupyter lab --no-browser \
    --port {port} --ip=0.0.0.0 --NotebookApp.base_url={base_path} \
    --NotebookApp.port_retries=0'

所有這些都同樣適用於jupyterlab,因此,您唯一要替換的arg可能是帶有lab notebook 同時,您根本不需要更改默認命令,因為如果安裝了lab擴展,則在啟動jupyter notebook時,可以在/lab URL上jupyter notebook 您現在可以通過在任何現有的tmpnb.org URL上將/tree替換為/lab來看到此信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM