我已经构建了一个包含最新 anaconda 版本的奇点映像(jupyter.sif),我想用它来运行一个 jupyter 笔记本。
我想运行这样的东西:
singularity exec \
--bind /path/outside/image/:/path/inside/image/ \
jupyter.sif jupyter notebook \
--notebook-dir=/path/to/dir --no-browser --ip=127.0.0.1
本质上,只需启动一个普通的 jupyter notebook,它将使用 python 版本和安装在奇异图像中的包。理想情况下,笔记本将在图像之外读取和写入文件(因此我指定了绑定路径)。
但是,当我运行上述命令时,出现以下错误:
> Traceback (most recent call last): File
> "/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py", line
> 528, in get
> value = obj._trait_values[self.name] KeyError: 'runtime_dir'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>
> File "/opt/conda/bin/jupyter-notebook", line 11, in <module>
> sys.exit(main())
>
> File
> "/opt/conda/lib/python3.7/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.7/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.7/site-packages/traitlets/config/application.py",
> line 87, in catch_config_error
> return method(app, *args, **kwargs)
>
> File
> "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line
> 1626, in initialize
> self.init_configurables()
>
> File
> "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line
> 1319, in init_configurables
> connection_dir=self.runtime_dir,
>
> File
> "/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py", line
> 556, in __get__
> return self.get(obj, cls)
>
> File
> "/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py", line
> 535, in get
> value = self._validate(obj, dynamic_default())
>
> File
> "/opt/conda/lib/python3.7/site-packages/jupyter_core/application.py",
> line 99, in _runtime_dir_default
> ensure_dir_exists(rd, mode=0o700)
>
> File
> "/opt/conda/lib/python3.7/site-packages/jupyter_core/utils/__init__.py",
> line 13, in ensure_dir_exists
> os.makedirs(path, mode=mode)
>
> File "/opt/conda/lib/python3.7/os.py", line 211, in makedirs
> makedirs(head, exist_ok=exist_ok)
>
> File "/opt/conda/lib/python3.7/os.py", line 211, in makedirs
> makedirs(head, exist_ok=exist_ok)
>
> File "/opt/conda/lib/python3.7/os.py", line 221, in makedirs
> mkdir(name, mode)
>
> OSError: [Errno 30] Read-only file system: '/run/user'
我认为这是因为笔记本正在尝试在图像中写入内容,并且因为我没有将图像作为 sudo 运行(我不想这样做),而且我在执行图像时也没有指定 --writable (也不想这样做),它抱怨无法在图像中写入。
有没有办法“告诉”图像在我的主目录而不是图像内部读取和写入文件?
谢谢