0

Every time, I use Jupyter Notebook in Ubuntu 18.04, I have to access sudo bash first and then type jupyter notebook --allow-root to use Jupyter Notebook without any problem. This is because when I use normal user to access jupyter notebook, I will always get this error. enter image description here

Every time I try to create new jupyter notebook workspace, I will get this error. I can't just type $ jupyter notebook to use Jupyter workspace and save my new creation.

Please, could you tell me how to fix this issue?

UPDATE

This is what I see in /home/sura/.local/share/jupyter/notebook_secret using sudo nano

enter image description here

And this is what I see in ls -l /home/sura/.local/share/jupyter

enter image description here

5
  • Have you checked the permissions of /home/sura/.local/share/jupyter/notebook_secret? Run ls -l /home/sura/.local/share/jupyter and add the output to your question. May 20, 2018 at 11:12
  • Yes, I have checked the path /home/sura/.local/share/jupyter/notebook_secret, but there is nothing in there. It's totally empty.
    – Liu Bei
    May 20, 2018 at 11:34
  • I have updated all the requirements you need to see, do you have any solution for my issue? It seems that Jupyter Notebook was set to be used as root.
    – Liu Bei
    May 20, 2018 at 11:48
  • It is far easier for people to help you if in future you just copy and paste output from commands into your answer and mark them as code using the '{}' button instead of posting screenshots. May 20, 2018 at 12:16
  • I am so sorry. I will improve myself. By the way, do you have any solutions?
    – Liu Bei
    May 20, 2018 at 12:25

1 Answer 1

2

Disclaimer: I have no experience with Jupyter.

It seems that your Jupyter data files are owned by root and therefore your user may not write to them. This is most probably the case because you ran Jupyter as root.

To rectify, you need to change the ownership of the files to your user.

Run sudo chown -R sura:sura /home/sura/.local/share/jupyter and test if it works now. If it still does not work, check the error message. After the term "permission denied" is a path. Check the permissions of that path (ls -l <path>) and if the file or directory belongs to root, change then owner (sudo chown -R sura:sura <path>).

Afterwards, never run Jupyter as root, always as your user.

4
  • Hello, the solution you gave me causes another error. Unexpected error while saving file: Documents/python/Untitled.ipynb [Errno 13] Permission denied: u'/home/sura/Documents/python/.ipynb_checkpoints/Untitled-checkpoint.ipynb' I don't know why this can happen, hahahaha
    – Liu Bei
    May 20, 2018 at 12:24
  • As stated, you need to repeat that process (check ownership and fix it) until you can save again. I suspect you have a bunch of files used by Jupyter and owned by root scattered all over your home directory. For this file you should check ownership of /home/sura/Documents/python/ and /home/sura/Documents/python/.ipynb_checkpoints using ls -l path. If either belongs to root, run sudo chown -R sura:sura on it. If unsure you can just run sudo chown -R sura:sura /home/sura/Documents/python and keep your fingers crossed. May 20, 2018 at 12:33
  • Hello, I can fix this issue by using your way. I have used sudo chown -R sura:sura /home/sura/Documents/python/.ipynb_checkpoints at the end. Thank you very much
    – Liu Bei
    May 20, 2018 at 12:33
  • Now I can just type $ jupyter notebook in the terminal. And also I can use jupyter notebook as root.
    – Liu Bei
    May 20, 2018 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .