Jupyter Notebook Won't Open in Newly Installed Firefox Quantum - firefox

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.

Related

Jupyter Lab shows last used folder as the root directory when run from terminal (can't go up), but it's ok when run from Anaconda

I've been using Anaconda and Jupyter Lab & Notebook for a couple of months. I have 4 environments and had the usual problems I guess everyone has with package conflicts and such.
Today, when I was running a ipynb file in Jupyter Lab (run from Terminal), it got stuck when iterating over files and unzipping them, so I rebooted my Mac.
When I entered Jupyter Lab again, the folder it showed in the file browser was the last one I had used. It didn't have the option of going up, and if I entered a path in "open from path", it said that it couldn't find it. It's like the last folder I used is now considered the root path.
I tried running Jupyter Lab again from terminal, but same thing.
Of course, other environments weren't affected.
I thought it was a Jupyter Lab configuration problem, but when I run Jupyter Lab from Anaconda, it went back to working perfectly, so I'm wondering if there is a configuration setup specifically for Terminal.
I can work from Anaconda, and I can also reinstall the environment if needed, but I'd prefer to go back working the way I was.
Jupyter Notebook works fine.
Can anyone shed a light on what can be happening?
Thanks!
I tried:
reboot the computer
exit and reenter Jupyter Lab
go to "open from path"
search for jupyter config file with "jupyter --config-dir". Found "default-37a8.jupyterlab-workspace" in the /User/.jupyer/lab/workspaces folder, and it has the initial config for Jupyter Lab (directory, files opened), but it takes the info from when I close the instance I run from Anaconda. When run from terminal it's like it takes the initial config from somewhere else.

Unable to open a new Jupyter notebook [Permission denied]

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

Associate ipynb files with Jupyter notebook in Windows 10 (Anaconda)

I installed Anaconda on my Windows 10 machine.
I have a few Jupyter notebooks on my pc and I would like to associate them with Jupyter, so they can be opened by double-clicking on the file, to avoid having to open Jupyter and navigate to the notebooks folders each time. Is this possible?
All notebooks should open in the same Jupiter Kernel (same localhost in the browser address bar), without starting a new kernel for every file I click.
PS I asked here because I figured this question to be more of interest for programmers, but if you think it would be more suited for SuperUser, I'll flag it for migration.
Install nbopen: https://github.com/takluyver/nbopen
pip install nbopen
python -m nbopen.install_win
Now you can double-click on *.ipynb files:
If you have Jupyter installed with Anaconda you can do the following.
Create a little batch file (e.g. start_jupyter_notebook.bat) with the content (the commands are from the Jupyter shortcut):
#echo off
set ANACONDAPATH=C:\_work\_programs\Anaconda3
%ANACONDAPATH%\python.exe %ANACONDAPATH%\cwp.py %ANACONDAPATH%^
%ANACONDAPATH%\python.exe %ANACONDAPATH%\Scripts\jupyter-notebook-script.py %1
(of course you will have to change the ANACONDAPATH to your installation)
Then go to one .ipynb file of your choice, right-click on it, go to properties --> open with --> change and select your created batch file.
I am pretty sure this can also be setup for any other Python/Jupyter installation.
P.S. The cwp.py file sets up some environment variables. I guess this is the reason why fredm73's answer did not work for everybody. Apart from that my answer is quite similar in the end.
associate .ipnyb with jupyter-notebook.exe
On Windows 10: control panel/Programs/Default Programs/Associate a file type or protocol with a program/Choose default apps by file type
Look at the list of extensions, find '.ipnyb'. Click on icon and locate the jupyter notebook program. In my Anaconda installation, it is found at
anaconda/scripts/jupyter-notebook.exe
Easiest way for me - double click on the .ipnyb file. When prompted to pick a program to open the extension with go to /ProgramData/Anaconda3/Scripts and locate the jupyter-notebook.exe file and click it.
NOTE - to access the ProgramData folder you will need to view hidden folders in the Windows explorer or access it by typing %programdata% in the navigation line:
You can use nbopen on pip and run the module:
py -m pip install -U nbopen
py -m nbopen.install_win
For those who installed nbopen in Anaconda but it does not work:
Use Regedit to search for a directory called Jupyter.nbopen, and navigate to its shell\open\command. It should be something like:
HKEY_USERS\****\Software\Classes\Jupyter.nbopen\shell\open\command
Then, change the default to: (Modify the path if you are not installed in default location)
"C:\ProgramData\Anaconda3\pythonw.exe" "C:\ProgramData\Anaconda3\cwp.py" "C:\ProgramData\Anaconda3" "C:\ProgramData\Anaconda3\pythonw.exe" -m nbopen "%1"
The reason behind this is that cwp.py makes sure that the Jupyter is running in Anaconda instead of other Python environments.
Then it should work, although it will activate two invisible pythonw process running in the background.
Just look into your file directory and look for programs that can open the file type and set it as your default app opener but you need to take into consideration that if you want to use Jupiter notebook, you can run jupyternotebook app and locate the file from the jupyter notebook directory.
Secondly, ensure you have added your python.eex to path and run directly from your command prompt. See pictures in the screenshot
Find the jupter-notebook.exe in the C:\Users\my_username\Anaconda3\Scripts folder. Copy the address. When you're opening the .ipnyb file double click ( if first time) or just do open with and there in the menu you can tick the 'always use this' option and locate the notebook from 'look more programs' option in the menu.

Changing Jupyter Notebook start up folder by modifying "start in" not working any more

I used to be able to change the default start up folder for Jupyter (the folder Jupyter displays in browser when it was first started) by modifying the "start in" option of the Notebook launch icon's properties on Windows, as described here and here.
However, this is not working any more after I recently installed Anaconda 3. Even though I changed the "start in" folder to the folder I wish, the browser still goes to "Documents" folder by default. I tried doing this as admin, still didn't work. Any suggestions? Thanks!
Although a permanent fix is still not found, I do have the following workaround that works great!
Using the way described here, change the start up dir for Anaconda prompt, then launch it and make sure the default folder is the one you want, and type "jupyter notebook". There! The notebook should launch in your desired folder.
UPDATE:
You can also directly launch Anaconda Prompt, then use cd C:\Users\Name\Folder to navigate into the folder where your iPython notebook files are located, and then use jupyter notebook or jupyter notebook myfile.ipynb to start working!
The only thing that worked for me to permanently fix the default working directory is by using this comment by MrFancypants.
In your default directory (documents), there is a hidden folder /.jupyter and within it a config python file.
you can edit it and change the line
## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''
to
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'ENTER_PATH_HERE'
where you should put your favorite path instead of 'ENTER_PATH_HERE.

Is it possible to navigate to a parent directory in the jupyter tree?

Normally, I launch jupyter from a new bash terminal:
~$ jupyter notebook
and then navigate down the tree to the files I want to work at.
I just did it from a terminal that was already running at a different path:
~/blah/blah/blah$ jupyter notebook
and realized that that directory becomes the home for jupyter. I wanted to work at a file located at, say ~/blah/thingy/luis.ipynb, but couldn't find my way up.
How do I navigate the directory tree upwards in jupyter notebook?
As explained in https://github.com/ipython/ipython/issues/7751, it is not possible to navigate to the parent directory for security reasons:
The kernel might not be python, nor on the same machine than the
server, nor do you need a running kernel to use server API(s).
If you want, you can ask for more information in the aforementioned GitHub issue.
As edwinksl pointed out it is not possible for security reasons. See https://github.com/jupyter/notebook/issues/2032.
But if you want to keep your luis.ipynb file in its original location and still be able to access it from Jupyter Notebook browser, you can create a symlink to it in your running Jupyter Notebook directory:
ln -s ~/blah/thingy/luis.ipynb ~/blah/blah/blah/
For more details on symlinks see https://www.howtogeek.com/297721/how-to-create-and-use-symbolic-links-aka-symlinks-on-a-mac/

Resources