Need assistance with starting jupyter notebook

I am using Ubuntu 18.04 on a Lenovo T420 laptop.

I installed jupyter notebook with:
james@james-ThinkPad-T420:~$ sudo apt install jupyter

I would like to use it with Python so I checked that it was installed:
james@james-ThinkPad-T420:~$ python3 --version
Python 3.6.9

When I try to start jupyter notebook as follows:
james@james-ThinkPad-T420:~$ jupyter notebook
I get quite a few lines of output, the last being:
PermissionError: [Errno 13] Permission denied: ‘/home/james/.local/share/jupyter/runtime’

So, I tried this:
james@james-ThinkPad-T420:~$ sudo jupyter notebook --allow-root
I get quite a few lines of output, the last being:
xdg-open: no method available for opening ‘http://localhost:8888/tree?token=768252a066e5f819e6aa55fd93b77e72f08926f121eed339

I open the link and jupyter notebook starts.

This is a very cumbersome way to get jupyter notebook to work.

My question is: How do I get jupyter notebook to work with just the following command?
james@james-ThinkPad-T420:~$ jupyter notebook

Thank you for your assistance in advance.

You may have some files owned by root instead of your regular james account. (This can happen easily if you have to run something with sudo.) Changing the ownership back to your james account should do what you’re looking for.

Here’s how to fix the ownership:

sudo chown -R james /home/james/.local/share/jupyter

Worked perfect. Thank you very much.

1 Like

I need a little more assistance. Everything works fine when except when I run “jupyter notebook” in a Venv:

(myPython3VEnv) james@myB01:~/Public/Projects$ jupyter notebook

I get a permission error as shown in attached image file.

Thank you for your any assistance in advance.

This may be an ownership issue similar to your original post.

To see if there’s an ownership issue try running:

ls -la ~/Public/Projects

Your output should have a format similar to this:

drwxrwxr-x. 5 jovyan users  64 Nov 15  2017 .
drwxr-xr-x. 9 jovyan root  218 Nov  8 17:50 ..
drwxr-xr-x. 2 jovyan users  28 Jul 30  2015 .hidden
drwxr-x---. 2 jovyan users  29 Jul 30  2015 sra_metadata
drwxr-xr-x. 2 jovyan users  52 Nov 15  2017 untrimmed_fastq

If you see root or some other account besides james in the same position as jovyan, then your james account doesn’t own that file/directory. (I suspect that may be the case for the directory that appears as . – this will refer to ~/Public/Projects in your command output.) If so, you can fix the ownership with the same way as before; the only difference in the command is the file/directory:

sudo chown -R james ~/Public/Projects
1 Like

That’s great, Thanks.

1 Like