Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Jupyter, where is '/home/jovyan'?

I don't know how to open a local file in Jupyter.Some answers say that I should change this workflow.

so, I had tried this in Jupyter on Mac:

In:

%pwd

Out:

'/home/jovyan'

In:

%cd /Users/apple/Desktop

Out:

[Errno 2] No such file or directory: '/Users/apple/Desktop'
/home/jovyan

What's wrong?
And then, I can not find '/home/jovyan' on my Mac.

like image 601
bytefish Avatar asked Oct 27 '17 15:10

bytefish


1 Answers

I figured I'd answer this in case anyone has been googling for the answer.

The folder jovyan does not exist on your machine. /home/jovyan is a workspace that exists within the docker image and is baked into it.

What you need to do is re-map the workspace so that you don't have to create a fake jovyan directory on your machine (because the docker image will be expect it if you don't specify something else).

This is how you re-map workspaces:
(https://medium.com/fundbox-engineering/overview-d3759e83969c)

docker run -p 8888:8888 -v /desired/host/folder:/home/jovyan/workspace jupyter/all-spark-notebook

In the command above, notice the two directories separated by a colon :

| /desired/host/folder | refers to the folder on host |
| /home/jovyan/workspace | workspace in the docker image |

Performing this re-map allows you to work with the image without having to worry about what it expects as a working directory.

like image 69
Kartik Nagappa Avatar answered Oct 16 '22 10:10

Kartik Nagappa