change the ownership of the
~/.local/share/jupyter directory from root to user.
sudo chown -R user:user ~/.local/share/jupyter
see here: https://github.com/ipython/ipython/issues/8997
user before the colon is your username, the second
user after the colon is your group. If you get
chown: [user]: illegal group name, find your group with
groups, or specify no group with
sudo chown user: ~/.local/share/jupyter.
-R option in comments to the answer. You have to change ownership of all files inside this directory (or inside
~/.jupyter/, wherever it gives you PermissionError) to your user to make it work.
If this fails, change the ownership of the directory you want to create the notebook in. For
sudo chown -R user:user mydir/*
Note that I replaced
bexgboost is my UNIX username.