我已经构建了一个包含最新 anaconda 版本的奇异图像 (jupyter.sif),我想用它来运行 jupyter notebook。我想运行这样的东西: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)我认为这是因为笔记本试图在图像中写入内容,并且因为我没有将图像作为 sudo 运行(我不想这样做)并且我在执行图像时也没有指定 --writable (也不想这样做),它抱怨无法在图像中写入。有没有办法“告诉”图像在我的主目录中而不是在图像内部读取和写入文件?
3 回答

MMMHUHU
TA贡献1834条经验 获得超8个赞
我刚刚遇到了同样的问题,这似乎已经为我解决了:将容器内的 /run/user 映射到外部工作目录(或您选择的目录)。对于您的情况,可能意味着:
singularity exec --bind /path/outside/image/:/path/inside/image/ --bind $PWD:/run/user jupyter.sif jupyter notebook --notebook-dir=/path/to/dir --no-browser --ip=127.0.0.1
像这样运行时,在我的情况下1000
创建了一个文件夹

拉丁的传说
TA贡献1789条经验 获得超8个赞
这适用于奇点实例,例如:
singularity instance.start --writable --contain --bind shared:/shared sandbox/ jupyter
添加回答
举报
0/150
提交
取消