Qiskit-Extensions / circuit-knitting-toolbox

Tools for knitting quantum circuits with Qiskit
https://qiskit-extensions.github.io/circuit-knitting-toolbox/
Apache License 2.0
70 stars 24 forks source link

Docker: Can't create file in persistent-volume via Jupyter interface (Permission denied) #548

Closed kevinsung closed 2 months ago

kevinsung commented 2 months ago

To reproduce:

  1. Follow instructions for using with Docker.
  2. In Jupyter web interface, navigate to the persistent-volume directory and try to create a notebook there.

Result: image

Logs:

notebook_1  | [I 2024-04-13 06:46:29.508 ServerApp] Creating new notebook in /persistent-volume
notebook_1  | [W 2024-04-13 06:46:29.526 ServerApp] 403 POST /api/contents/persistent-volume?1712990789391 (172.20.0.1): Permission denied: persistent-volume/Untitled.ipynb
notebook_1  | [W 2024-04-13 06:46:29.527 ServerApp] wrote error: 'Permission denied: persistent-volume/Untitled.ipynb'
notebook_1  |     Traceback (most recent call last):
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/fileio.py", line 219, in perm_to_403
notebook_1  |         yield
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/fileio.py", line 209, in atomic_writing
notebook_1  |         with atomic_writing(os_path, *args, **kwargs) as f:
notebook_1  |       File "/opt/conda/lib/python3.11/contextlib.py", line 137, in __enter__
notebook_1  |         return next(self.gen)
notebook_1  |                ^^^^^^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/fileio.py", line 108, in atomic_writing
notebook_1  |         fileobj = open(path, "w", encoding=encoding, **kwargs)  # noqa
notebook_1  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
notebook_1  |     PermissionError: [Errno 13] Permission denied: '/home/jovyan/persistent-volume/Untitled.ipynb'
notebook_1  |     
notebook_1  |     The above exception was the direct cause of the following exception:
notebook_1  |     
notebook_1  |     Traceback (most recent call last):
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1786, in _execute
notebook_1  |         result = await result
notebook_1  |                  ^^^^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 232, in post
notebook_1  |         await self._new_untitled(path, type=type, ext=ext)
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 179, in _new_untitled
notebook_1  |         model = await ensure_async(
notebook_1  |                 ^^^^^^^^^^^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 189, in ensure_async
notebook_1  |         result = await obj
notebook_1  |                  ^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/manager.py", line 974, in new_untitled
notebook_1  |         return await self.new(model, path)
notebook_1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/manager.py", line 1000, in new
notebook_1  |         model = await self.save(model, path)
notebook_1  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/largefilemanager.py", line 133, in save
notebook_1  |         return await super().save(model, path)
notebook_1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/filemanager.py", line 914, in save
notebook_1  |         await self._save_notebook(os_path, nb, capture_validation_error=validation_error)
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/fileio.py", line 402, in _save_notebook
notebook_1  |         with self.atomic_writing(os_path, encoding="utf-8") as f:
notebook_1  |       File "/opt/conda/lib/python3.11/contextlib.py", line 137, in __enter__
notebook_1  |         return next(self.gen)
notebook_1  |                ^^^^^^^^^^^^^^
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/fileio.py", line 206, in atomic_writing
notebook_1  |         with self.perm_to_403(os_path):
notebook_1  |       File "/opt/conda/lib/python3.11/contextlib.py", line 155, in __exit__
notebook_1  |         self.gen.throw(typ, value, traceback)
notebook_1  |       File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/fileio.py", line 228, in perm_to_403
notebook_1  |         raise HTTPError(403, "Permission denied: %s" % path) from e
notebook_1  |     tornado.web.HTTPError: HTTP 403: Forbidden (Permission denied: persistent-volume/Untitled.ipynb)
garrison commented 2 months ago

Thanks for the report -- I guess I never actually tried saving an image!