1

I am reading the book Machine Learning Engineering with MLflow and in the most basic of examples I got the error of the title.

There is a very simple docker file

FROM jupyter/scipy-notebook
RUN pip install mlflow
RUN pip install sklearn

and I build it with docker build -t chapter_1_homlflow .

However I am working on a windows 10 machine so I run the docker with:

docker run -p 8888:8888 -p 5000:5000 -v %cd%:/home/jovyan/ -it chapter_1_homlflow

The jupyter notebook starts running but then I got the error

Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-lab", line 10, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/jupyter_server/extension/application.py", line 594, in launch_instance
    serverapp.start()
  File "/opt/conda/lib/python3.9/site-packages/jupyter_server/serverapp.py", line 2757, in start
    self.start_app()
  File "/opt/conda/lib/python3.9/site-packages/jupyter_server/serverapp.py", line 2687, in start_app
    self.write_server_info_file()
  File "/opt/conda/lib/python3.9/site-packages/jupyter_server/serverapp.py", line 2503, in write_server_info_file
    with secure_write(self.info_file) as f:
  File "/opt/conda/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/opt/conda/lib/python3.9/site-packages/jupyter_core/paths.py", line 903, in secure_write
    raise RuntimeError(
RuntimeError: Permissions assignment failed for secure file: '/home/jovyan/.local/share/jupyter/runtime/jpserver-7.json'. Got '0o655' instead of '0o0600'.

I tried advice found in SO so I changed

docker run -p 8888:8888 -p 5000:5000 -v /users/user/ML_MLflow/Machine-Learning-Engineering-with-MLflow/Chapter01:/home/jovyan/ -it chapter_1_homlflow

and the error went away but now I got the error

 [Errno 13] Permission denied: '/home/jovyan/.local'
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/traitlets/traitlets.py", line 642, in get
    value = obj._trait_values[self.name]
KeyError: 'runtime_dir'

Is this a product of using windows? How can the jupyter from inside the container can be run?

EDIT: I could overcome the problem thanks to the advice from here so I did

docker run --user root -e CHOWN_HOME=yes -e CHOWN_HOME_OPTS=-R -p 8888:8888 -p 5000:5000 -v /users/user/ML_MLflow/Machine-Learning-Engineering-with-MLflow/Chapter01:/home/jovyan/ -it --rm chapter_1_homlflow

and now I got the jupyter lab running (although with a password so I had to access it with the url that is output in the command window)

Now the problem is that the mapping (the -v option above) does not happen and /home/jovyan is empty.

EDIT2: Now I found that I made a spelling mistake and I should have put Users with capital U. But with this now I get the error

Error while creating the mounting path. mkdir /Users file exists. 

Similar error to this question

The only reason I can find is that the Users folder actually is in japanese, in file explorer

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • Have you tried setting `ENV JUPYTER_ALLOW_INSECURE_WRITES=1` in the Dockerfile? – Håken Lid May 20 '22 at 15:41
  • 1
    You could also try `ENV JUPYTER_RUNTIME_DIR=/tmp`. Not sure if the insecure writes directive works in current versions of jupyter. `docker run -e JUPYTER_RUNTIME_DIR="/tmp" -p 8888:8888 -p 5000:5000 -v %cd%:/home/jovyan/ -it chapter_1_homlflow` – Håken Lid May 20 '22 at 15:50

0 Answers0