Jupyter Notebook在奇异容器中

问题描述

在装入奇异容器后,如何在浏览器中启动jupyter笔记本-我找不到很多文档?我正在使用ssh进入的centos linux发行版。

Jupyter已安装在容器中。 singularity shell --writable ....sif之后,您如何真正在浏览器上运行一个jupyter笔记本?基本代码:jupyter notebook --no-browser --port=7800会返回此错误:

Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-notebook",line 11,in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.6/site-packages/jupyter_core/application.py",line 266,in launch_instance
    return super(JupyterApp,cls).launch_instance(argv=argv,**kwargs)
  File "/opt/conda/lib/python3.6/site-packages/traitlets/config/application.py",line 657,in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>",line 2,in initialize
  File "/opt/conda/lib/python3.6/site-packages/traitlets/config/application.py",line 87,in catch_config_error
    return method(app,*args,**kwargs)
  File "/opt/conda/lib/python3.6/site-packages/notebook/notebookapp.py",line 1628,in initialize
    self.init_configurables()
  File "/opt/conda/lib/python3.6/site-packages/notebook/notebookapp.py",line 1319,in init_configurables
    connection_dir=self.runtime_dir,File "/opt/conda/lib/python3.6/site-packages/traitlets/traitlets.py",line 556,in __get__
    return self.get(obj,cls)
  File "/opt/conda/lib/python3.6/site-packages/traitlets/traitlets.py",line 535,in get
    value = self._validate(obj,dynamic_default())
  File "/opt/conda/lib/python3.6/site-packages/jupyter_core/application.py",line 99,in _runtime_dir_default
    ensure_dir_exists(rd,mode=0o700)
  File "/opt/conda/lib/python3.6/site-packages/jupyter_core/utils/__init__.py",line 13,in ensure_dir_exists
    os.makedirs(path,mode=mode)
  File "/opt/conda/lib/python3.6/os.py",line 210,in makedirs
    makedirs(head,mode,exist_ok)
  File "/opt/conda/lib/python3.6/os.py",line 220,in makedirs
    mkdir(name,mode)
OSError: [Errno 30] Read-only file system: '/run/user/19241'

解决方法

启动笔记本后,会为您提供输出链接,您可以将其粘贴到浏览器中。请参见下面的示例输出。

您确定映像已成功构建/完全传输吗?我无法复制该错误。如果仍然出现该错误,请使用定义文件/有关如何生成图像的命令来更新问题。

$ singularity pull docker://jupyter/scipy-notebook
INFO:    Converting OCI blobs to SIF format
INFO:    Starting build...
Getting image source signatures
Copying blob 692c352adcf2 done
...
2020/08/31 09:23:15  info unpack layer: sha256:2be4f33acc3414896b4c608db82138711c62386174f91319cd1f317b54431fda
INFO:    Creating SIF file...
INFO:    Build complete: scipy-notebook_latest.sif

$ singularity shell scipy-notebook_latest.sif 
Singularity> jupyter notebook --no-browser --port=7800
[I 09:28:37.259 NotebookApp] Writing notebook server cookie secret to /home/tsnowlan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 09:28:38.266 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.8/site-packages/jupyterlab
[I 09:28:38.266 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 09:28:38.269 NotebookApp] Serving notebooks from local directory: /data/playground/jupyter
[I 09:28:38.269 NotebookApp] Jupyter Notebook 6.1.3 is running at:
[I 09:28:38.269 NotebookApp] http://localhost:7800/?token=xxxx
[I 09:28:38.269 NotebookApp]  or http://127.0.0.1:7800/?token=xxxx
[I 09:28:38.269 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:28:38.273 NotebookApp] 
    
    To access the notebook,open this file in a browser:
        file:///home/tsnowlan/.local/share/jupyter/runtime/nbserver-114505-open.html
    Or copy and paste one of these URLs:
        http://localhost:7800/?token=xxxx
     or http://127.0.0.1:7800/?token=xxxx

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...