Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run jupyter notebook in background on windows ?

I want to run jupyter notebook on windows, but it always left a blocking terminal "window command prompt", how can I avoid it and let the jupyter server run in background?

like image 362
archerC Avatar asked Jun 30 '16 08:06

archerC


3 Answers

I want to do this too and have found a solution from my friends, but i can't understand it,because i kown fewer about windows commond line. here is the solution, i test it on win8 and win10:

First: create a new .bat file and add below line to the file:

jupyter notebook

before this, you should be sure that you can run jupyter notebook on the cmd by type the command of 'jupyter notebook'. when finished,better to double click this .bat file and test if it could run jupyter notebook. e.g. this file is named as jupyter.bat.

Second: create a new .vbs file and add this tow line to the file:

Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c jupyter.bat",vbhide

the jupyter.bat should be changed to you .bat file, and save this file, double click it. then the jupyter run as a background process. note that, when you double click .vbs file, there is nothing for prompt. and when you want to shut down jupyter, open task manager, find python process, close it.

good luck!

like image 81
Panda Avatar answered Sep 24 '22 11:09

Panda


On Windows, many people use unix terminal emulators: Cygwin, MSYS2, WSL for Windows 10. You can easily give it a try by downloading the Git for Windows command line — no administrator rights or password required, either.

Your shell's configuration file is typically found in ~/.bashrc. I have added the following aliases to it:

alias jn="cd $HOME && jupyter notebook &> /dev/null &"
alias jnk='ps -W | grep "jupyter-notebook" | awk "{print \$1}" | xargs kill -f'

The first one simply starts a jupyter notebook in the background by redirecting both stdout and stderr to /dev/null, and gives you the PID of the process:

$ jn
[1] 9524

The second simply kills any process that's got the name jupyter-notebook:

$ jnk
[1]+  Done  cd $HOME && jupyter notebook &> /dev/null

I know this only answers the answer diagonally, but hope you'll find it useful nonetheless.

like image 40
François Leblanc Avatar answered Sep 26 '22 11:09

François Leblanc


Try

start /min jupyter notebook

It will still open a window but that is minimized.

like image 35
BaJoe Avatar answered Sep 26 '22 11:09

BaJoe