Cannot Open New Jupyter Notebook [Permission Denied]
I Have Installed Jupyter Notebook on Ubuntu 16.04 Using Pip3. I Can Execute Jupyter Notebook Command. It Opens and Shows a List of Current Path Directories...
I have installed Jupyter Notebook on ubuntu 16.04 using pip3. I can execute jupyter notebook command. It opens and shows a list of current path directories.
But I cannot create a new notebook(Python3). It says
Unexpected error while saving file: Deep Learning/NN/Untitled.ipynb [Errno 13] Permission denied: '/home/ubuntu/.local/share/jupyter/notebook_secret'
change the ownership of the ~/.local/share/jupyter directory from root to user.
sudo chown -R user:user ~/.local/share/jupyter
see here:
The first 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.
EDIT: Added -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.
In my opinion, it is a good practice to run Jupyter in a dedicated workbook folder.
$ mkdir jupyter_folder
$ jupyter-notebook --notebook-dir jupyter_folder
where 'jupyter_folder' is a folder in my home.
This method works without any permission issues.
Tried everything that was suggested but finally this helped me:
sudo jupyter notebook --allow-root
In my case, it didn't start the browser by itself. So just copy the link from terminal and open it by yourself.
Update: Change folder(.local) permissions by this command:
sudo chmod -R 777 .local
On Ubuntu, 'permission denied' may appear when browser is installed as a 'snap'. I had this problem. I edited config file to open a regular browser and it worked.
How to change the default browser used by the ipython/jupyter notebook in Linux?
The top answer here didn't quite fix the problem, although it's probably a necessary step:
sudo chown -R user:user ~/.local/share/jupyter
(user should be whoever is the logged in user running the notebook server) This changes the folder owner to the user running the server, giving it full access.
After doing this, the error message said it didn't have permission to create the checkpoint file in ~/.ipynb_checkpoints/ so I also changed ownership of that folder (which was previously root)
sudo chown -R user:user ~/.ipynb_checkpoints/
And then I was able to create and save a notebook!
- Open Anaconda prompt
- Go to
C:\Users\your_name - Write
jupyter trust untitled.ipynb - Then, write
jupyter notebook
It might be a trust issue.
Command-line
jupyter trust /path/to/notebook.ipynb
here is the documentation link :
I had the very same issue running Jupyter. After chasing my tail on permissions, I found that everything cleared up after I changed ownership on the directory where I was trying to run/store my notebooks. Ex.: I was running my files out of my ~/bash dir. That was root:root; when I changed it to jim:jim....no more errors.
Seems like the problem is in the last release, so
pip install notebook==5.6.0
must solve the problem!
Try running "~/anaconda3/bin/jupyter notebook" instead of "jupyter notebook". This resolved the problem for me. No more getting 'permission denied' error.
- Create a configuration file:
jupyter notebook --generate-config. - Edit a configuration file:
sudo gedit /home/<USERNAME>/.jupyter/jupyter_notebook_config.py(You can usevim,nanoor anything else instead ofgedit) - Uncomment a line and change the default value:
BEFORE: # c.NotebookApp.use_redirect_file = True
AFTER: c.NotebookApp.use_redirect_file = False
This worked for me:
-> uninstalled Jupyter
-> install jupyter in Python36 folder
-> open Jupyter from command prompt instead of git bash.
I had to run chown recursively for all subfolders With /* . Than it worked:
sudo chown -R user:usergroup /home/user/.local/share/jupyter/*
You don't have to install or uninstall anything. if you are using python 2 use pip to install and upgrade. But if you want to use python3 then follow the steps below:
sudo apt-get install python3-pip python3-dev
then in terminal use this
pip3 install -U jupyter
final step is to launch jupyter notebook so,in terminal just type
jupyter notebook
all the issues or problems of premissions etc will be resolved.
I had the same issue and it turned out my windows password had changed since I shared my drive with docker.
The fix was to rest my credentials in docker settings -> shared drives -> reset credentials and then reshare my drive.
Executing the script below worked for me.
sudo chown $USER /home/$USER/.jupyter
I encountered same problem when I installed latest version of anaconda navigator 64 bit on windows 10.
I got to know that INSTALLING 32 BIT VERSION ON WINDOWS 10 will solve the issue. It worked for me. Jupyter is running smoothly now.
In windows, I copied, what I think is a snapshot:
.~SomeAmazingNotebook.ipynb
renamed it:
SomeAmazingNotebook.ipynb
and could open it.
None of the above worked for me but the below did:
sudo chown -R user: /Library/Frameworks/
Where user is your username.
I was launching it from the root dir "/" for which I was lacking the write permission and hence file creation failed as below
Unexpected error while saving file: Untitled.ipynb [Errno 30] Read-only file system: '/Untitled.ipynb'
Once after I re-launched it from other dir , I was able to proceed.
I tried opening from the Python folder and it helped.
C:\Users\Julia>appdata\local\programs\python\python39\python.exe -m jupyter notebook
Try creating the notebook in the /home/ubuntu folder
I closed notebook page and:
- I killed notebook kernel, since I was using DockerSpawner I needed to delete notebook's container
- I deleted user jupyter directory by running
rm -rf ~/.local/share/jupyter
When I tried to create new notebook next time, it started working
A complicated problem this one.. but finally I found a solution.
You need to generate a config file:
jupyter notebook --generate-config
Its created in the .jupyter directory. If its hidden, do a CTRL+H to unhide the files. Look for c.NotebookApp.use_redirect_file and make it like this:
c.NotebookApp.use_redirect_file = False.
Make sure to remove the # before the line. Otherwise it won't work. Done! :)
I solved the problem by changing the owner of my current folder. Whenever we type jupyter notebook on terminal, it always opens up in the current path (which we are pointing to via terminal), so we just have to change the owner to current user and then if you click on "new notebook", it will create one for you without giving permission denied error.
My os is Ubuntu 22.04 LTS. When I use Chrome, which was downloaded from official site. I solved this problem. Perhaps this is because Firefox and chromium on Ubuntu are base on Snap.
- List item
- List item
this problem of not able to open jupyter notebook is like Corona virus.I came across several complaints-including my own.I use windows 10.
Atlast after struggling for 3 days i came across this wonderful foolproof solution:-
1.The jupyter folder is created at path:- C:\Users\deviv_000\AppData\Roaming\jupyter your name will replace->deviv_000
2.Go to cmd and write : cd C:\Users\deviv_000\AppData\Roaming\jupyter this will take cmd to that folder.
3.Now create manually a file as untitled.ipynb in jupyter folder.
4.Come back to cmd and write: jupyter trust untitled.ipynb
5.After cmd performs this operation now write:-
jupyter notebook
SUCCESS!!- your notebook will appear in the next tab.I used chrome.
Regards
An easy way is to run your terminal in the mode of "Administrator"
On a Windows machine run the python command prompt as administrator. That should resolved the permissions issue when creating a new python 3 notebook.
Based on my experience on Ubuntu 18.04:
1. Check Jupyter installation
first of all make sure that you have installed and/or upgraded Jupyter-notebook (also for virtual-environment):
pip install --upgrade jupyter
2. Change the Access Permissions (Use with Caution!)
then try to change the access permission for you
sudo chmod -R 777 ~/.local
where 777 is a three-digit representation of the access permission. In sense that each of the digits representing short format of the binary one (e.g. 7 for 111). So, 777 means that we set permission access to read, write and execute to 1 for all users (Owner, Group or Other)
Example.1
777 : 111 111 111
or
777 : rwx-rwx-rwx
Example.2
755 : 111 101 101
- Owner: rwx=4+2+1=7
- Group: r-x=4+0+1=5
- Other: r-x=4+0+1=5
(More about chmod : File Permissions and attributes)
3. Run jupyter
afterwards run your jupyter notebook:
jupyter-notebook
Note: (These steps also solve your Visual-Studio code (VS-Code) problems regarding permissions while using ipython and jupyter for python-interactive-console.)