Unable to open a new Jupyter notebook [Permission denied] - windows

I have installed Jupyter Notebook on Windows 10. When I run the
jupyter notebook
command from cmd, the notebook dashboard opens in the browser. But when I try to create a notebook using the new>python3 option, I get an error message which says 'Permission denied.'
Please help me out.

You could use jupyter-lab --notebook-dir=%USERPROFILE% to always open in your home folder, which should have writable permissions
By default, Jupyter will use the directory where you started the command

Related

Can't open Jupyter notebook from command prompt

I have always opened the jupyter notebooks from the Anaconda prompt. The problem is that whenever I try to open the Jupyter notebook from the command prompt, the following error is displayed:
Picture of the Error shown on my command prompt window
ImportError: DLL load failed: The specified module could not be found.
What am I doing wrong ? What should I do?
Opening Jupyter Notebook from command prompt is useful, especially when you would like to open the Jupyter Notebook from a specific folder.
The following 2 steps might help you to resolve this issue.
open command prompt
activate base
The prompt might change to begin with "(base)", which is expected. Then type,
Jupyter-notebook
If Jupyter notebook opens up now, this means Jupyter is correctly installed within your conda environment. In OS like Windows 10, it was an expected behavior not to recognize Python outside of Conda environment, which extends to Jupyter Notebook as well.
If the 1st step works properly, then add the below paths to your
environment variable. If you would not like to add the path to your
system environment variable, you can choose to update in your
account environment variable.
In windows 10 >> search "environments" and "Edit environment
variables for your account"
Select "PATH" and edit.
Add below paths
C:\Users\\Anaconda3;
C:\Users\\Anaconda3\Scripts;
C:\Users\\Anaconda3\Lib;
C:\Users\\Anaconda3\Library\bin;
C:\Users\\Anaconda3\Library\mingw-w64\bin;
Now you should be able to open Jupyter Notebook directly from command prompt.

Jupyter Notebook Won't Open in Newly Installed Firefox Quantum

I installed the newest Firefox version (Quantum v. 65) on an Ubuntu machine and Jupyter Notebook will not open in it from either Anaconda or a command prompt.
I received the following error:
"Access to the file was denied
The file at /run/user/1000/jupyter/nbserver-11292-open.html is not readable.
It may have been removed, moved, or file permissions may be preventing access."
Any ideas on how to fix this would be greatly appreciated.
I'm having the same issue with Firefox snap.
Luckily, jupyter notebook, when run from the command line, also outputs a link that you can copy and paste on the browser (or just Ctr + click).
To access the notebook, open this file in a browser:
file:///run/user/1001/jupyter/nbserver-30315-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=a0602687337c0045f9dc2106a5a7fb466a9a86dd74378f64
Not an optimal solution but an acceptable work-around.

Permission denied: Untitled.ipynb Windows 10 AWS Workspaces

I have installed anaconda Python 2.7 on my AWS workspace with Windows 10 and I launch Jupyter Notebook from the anaconda command prompt. When I try to create a new notebook, I have an error:
[I 20:20:23.697 NotebookApp] Creating new notebook in
[W 20:20:23.795 NotebookApp] 403 POST /api/contents (::1): Permission denied: Untitled.ipynb
[W 20:20:23.796 NotebookApp] Permission denied: Untitled.ipynb
Could you please help? I have tried to look for a solution but it is not clear what needs to be done for Windows 10.
I'm not using AWS, but maybe this can help:
When I launched
jupyter notebook
from the anaconda command prompt, while starting up one of the first lines in the log in that command prompt window said:
[I <some timestamp> NotebookApp] Serving notebooks from local directory: C:\
Unfortunately, I don't have permissions to write into the C:\ directory.
So I generated a configuration file
jupyter notebook --generate-config
that ended up as jupyter_notebook_config.py in
%USERPROFILE%\.jupyter
Use
jupyter --paths
to see which directories your Jupyter on AWS is searching for config files.
Finally, in that config file there is a line you can comment out and point to the directory that should contain your notebooks (and kernels):
## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''
Of course, make sure the directory that you mention on that line is actually (created and) writeable by you.
You should just need to ensure that you (or more specifically the user running the program) has write-permissions on the folder where the new file Untitled.ipynb is being created. See this page on changing Windows 10 folder permissions for details.

How to make jupyter start in current directory by default (in cmd.exe)?

In Windows 10 cmd.exe I can start jupyter in a current directory by following command:
jupyter notebook --notebook-dir="."
The current directory is C:\Users\Евгений\Documents\GitHub\sandbox
However, when I start simply jupyter notebook in a current directory above my working directory for jupyter is D:/git:
λ cd
C:\Users\Евгений\Documents\GitHub\sandbox
λ jupyter notebook
[I 14:46:44.273 NotebookApp] The port 8888 is already in use, trying another port.
[I 14:46:44.304 NotebookApp] JupyterLab beta preview extension loaded from D:\Anaconda3\lib\site-packages\jupyterlab
[I 14:46:44.304 NotebookApp] JupyterLab application directory is D:\Anaconda3\share\jupyter\lab
[I 14:46:44.571 NotebookApp] Serving notebooks from local directory: D:/git
Note the last line Serving notebooks from local directory: D:/git. Where is D:/git may be coming from? Are there environment variables other than these affecting working directory choice?
My %USERPROFILE%/.jupyter is totally empty.
jupyter --config-dir directs to C:\Users\Евгений\.jupyter, it is %USERPROFILE%/.jupyter.
I read various threads about jupyter invoke, in particular:
this large thread suggests jupyter notebook will behave differently in cmd.exe and Anaconda prompt, without further details though
Problems with configuring Jupyter start directory addresses an issue with Windows shortcut, similar to this Windows app start steps
this post proposes wrapping --notebook-dir="." key into a .bat file
My other thought is that %USERPROFILE% with non-Latin character is not be recongnisable by jupyter, but %USERPROFILE%/.jupyter is empty anyways.
You must generate the configuration of Jupyter.
jupyter notebook --generate-config
Navigate to your folder and the folder .jupyter (C:\Users\%username%\.jupyter)
You will find a file called jupyter_notebook_config.py
Edit it with notepad++ for exemple and locate c.NotebookApp.notebook_dir
Between ' ' put the path you want. For exemple :
c.NotebookApp.notebook_dir = 'C:/Users/Евгений/Documents/GitHub/sandbox'
Save it and start Jupyter without specifying a path
Be careful, the characters in your username may be a problem.
Keep me informed.
Use the jupyter notebook config file:
Open cmd (or Anaconda Prompt) and run jupyter notebook --generate-config.
This writes a file to C:\Users\username\.jupyter\jupyter_notebook_config.py.
Browse to the file location and open it in an Editor
Search for the following line in the file: #c.NotebookApp.notebook_dir = ''
Replace by c.NotebookApp.notebook_dir = 'D:/git'
Make sure you use forward slashes in your path
Remove the # at the beginning of the line to allow the line to execute
Using docker and the images maintained by the Jupyter team:
docker run -v `pwd`:/home/jovyan -p 8890:8888 jupyter/scipy-notebook

Open new named jupyter notebook from terminal

I can open an existing jupyter notebook with a single command (from the docs):
When starting a notebook server from the command line, you can also open a particular notebook directly, bypassing the dashboard, with ipython notebook my_notebook.ipynb. The .ipynb extension is assumed if no extension is given.
However, when I want to open a new notebook it seems as if I have to follow 3 steps:
Run ipython notebook.
Open a new notebook by clicking New > Python 3.
Edit the name of the notebook
Question
Is there a command that allows me to combine these 3 steps in a single command, similar to the command to open existing notebooks? E.g., something like this pseudo code: ipython notebook --new my_notebook.ipynb.
Using this command you can create and open a new notebook without getting into the application. This command will work only in Linux operating system
jupyter notebook $(cat Untitled.ipynb >filename.ipynb && echo filename.ipynb)

Resources