How to get Jupyter Lab to start fresh with no open kernels? - jupyter-notebook

I've been using Jupyter Lab and everytime I open it, it has all of my notebooks from previous session open in Tabs and as open Kernels. I want to open my Jupyter with a fresh window that doesn't have anything I was working on previously.
How can I either modify my profile or Jupyter lab command to not include any previous Tabs or open Kernels?

Related

Unable to set the kernel ("Not specified") for a jupyter notebook in Pycharm

As seen in the screenshot the kernel is "Not specified" and can not set since the dropdown is disabled. Can this be remedied?
The Project interpreter is python3 and otherwise for other file types the project works fine
I've run into the same issue of PyCharm not allowing me to select a Jupyter kernel other than the one that is saved to the notebook (the drop-down menu is either grayed-out as in your picture, or disappears altogether). This condition appears to occur when the kernel that was active when the notebook was saved is not available in the current environment. The only workaround I've found for this situation is:
Start a Jupyter notebook server using the same Python environment as you are using in PyCharm
From the Jupyter server web page, open the notebook
From the Kernel menu, select Change kernel, and then select the desired kernel
Save the notebook, then close/halt it
Re-open the notebook in PyCharm. It should then be able to execute with the kernel that was chosen in Step 3 above.

Prevent jupyter console from reading code from jupyter notebook

When on jupyter console and I hit the up arrow key, I'd like to go to the previously run line of code on that console. However it will read a previously run cell from a jupyter notebook instead. Is there a way to prevent this from happening?

prevent jupyterlab from automatically starting new session for all open tabs

I shut down all kernels and close jupyterlab in the browser, but when I open it again it starts a session, and a kernel, for all opened notebooks
I'd followed the code and found that in jupyterlab notebook code the start session function calls (POST /api/sessions) on notebook load if there is not any running kernel for the current notebook. and the API creates a session and also starts a kernel.
I can't find any config for stopping this action in jupyter configs or jupyterlab settings (settings -> advanced settings editor)
You can prevent automatically starting kernels when you open a notebook by running Jupyterlab with the jupyter lab --LabServerApp.notebook_starts_kernel=False flag.
To make the configuration permanent, you can add
c.LabServerApp.notebook_starts_kernel = False to $(jupyter --config-dir)/jupyter_lab_config.py. If this file doesn't exist yet, generate it by running jupyter lab --generate-config.
See this issue comment for more details:
https://github.com/jupyterlab/jupyterlab/issues/12019#issuecomment-1145841583

There is a problem when opening Jupyter Notebook

I installed Anaconda 3 in Linux and tried to open Jupyter notebook in browser by typing 'jupyter notebook' in terminal.
But what I've got is the screen I added below.
As I guess, Jupyter Notebook is currently opened via 'Elinks', but I have no idea about what this is.
Do you know how to open Jupyter Notebook in the browser I want, such as Firefox or Chrome?
I wanted to add some information in case you wanted to later access juypter notebook via elinks (or any other text-based web browser in terminal).
I will also go over opening jupyter notebook with Anaconda Navigator.
First, You need to first install Node.js Javascript Runtime Environment by running this command in terminal.
sudo apt-get install node.js
Next, close and reopen terminal (I always do this when installing new software via command line).
When you next try to access your jupyter notebook via elinks it will ask for a token or password.
Option 1 : Token.
Find the token by entering jupyter notebook list in terminal.
Option 2 : Password.
You can create a password for jupyter notebook by entering jupyter notebook password in the terminal.
You can now use the token or your newly created password in order to access jupyter notebook via full-featured text web browser such as elinks.
If you want to access jupyter notebook via Firefox, Chrome, etc. then just use anaconda. This will automatically open jupyter notebook in your standard web browser.
Enter anaconda-navigator in terminal.
Once anaconda navigator opens, simply launch jupyter notebook from the selection.
You can set Firefox or Chrome as default browser, then it should open directly in it.
If it still doesn't, you can always copy the URLs which are displayed when jupyter notebook is started, and paste it in your browser.
To access the notebook, open this file in a browser:
file:///home/harshit/.local/share/jupyter/runtime/nbserver-2985-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=9fc770713dbd755750bbe842896420ecfa7abc038581fc04
or http://127.0.0.1:8888/?token=9fc770713dbd755750bbe842896420ecfa7abc038581fc04
By the way, jupyter notebook doesn't work, because, by default, JS is not enabled in eLinks browser (you can enable it).

Issue running jupyter notebook via wls

Installed WSL on Windows 10.
Installed Anaconda according to the Anaconda documentation with the following commands:
bash Anaconda3-2020.02-Linux-x86_64.sh
source ~/.bashrc
You can see the '(base)' in the beginning of each command input line, indicating the conda is activated.
Then I run jupyter notebook by typing:
jupyter notebook
Then I see the following changes as shown in the screen record.
Briefly, the WSL terminal window showed some information very quickly, but is changed to the windows powershell window before you could even tell the information that showed up. I know those information should contain a file and url for opening the jupyter notebook in the web browser. But they flashed out so quickly. Does anyone know why this happens?
Here is a dynamic graph of the Screen record of this issue:
Solved:
1. Wait for a bit more time on the windows cmd and the jupyter notebook running information will show up, where includes the url to open jupyter notebook in the web browser.
OR
Open up another wsl terminal, activate the same environment and type jupyter notebook list, which will show the current running jupyter notebook server. The url is also can be found there.

Resources