Jupyter Setting - Raidin/deeplearning-research GitHub Wiki

  • Install Jupyter
$ pip install jupyter
  • Config Setting

    • Default config ํŒŒ์ผ ์ƒ์„ฑ
    # /home/[user name]/.jupyter/ ํ•˜์œ„์— default config(jupyter_notebook_config.py) ํŒŒ์ผ ์ƒ์„ฑ๋จ
    $ jupyter notebook --generate-config
    
    • Config ์ˆ˜์ •
    $ cd ~/.jupyter
    $ vi jupyter_notebook_config.py
    
    $ ipython                                                                                                                                   
    In [1]: from IPython.lib import passwd
    In [2]: passwd()
    Enter password: 
    Verify password: 
    Out[2]: '[password key]'
    In [3]: ^D  #(^D๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ์ข…๋ฃŒ)                                                                                                              
    Do you really want to exit ([y]/n)? y
    
    ######################### modify #########################
    # default ip : 0.0.0.0
    # localhost๋งŒ ์ ‘์† ๊ฐ€๋Šฅ : 127.0.0.1
    c.NotebookApp.ip = โ€˜0.0.0.0โ€™
    
    # ์ ‘์† port ์ˆ˜์ •
    c.NotebookApp.port = 8888
    
    # ์ดˆ๊ธฐ ์‹คํ–‰ ์œ„์น˜
    c.NotebookApp.notebook_dir = โ€˜[directory path]โ€™
    
    # ์ตœ์ดˆ ์‹คํ–‰์‹œ browser์— open ์œ ๋ฌด
    c.NotebookApp.open_browser = False
    
    # passward์„ค์ •
    c.NotebookApp.password = '[input password key]'
    ##########################################################
    
  • Background ์‹คํ–‰ ๋ฐฉ๋ฒ•

    • ์‹คํ–‰ ๋ช…๋ น์–ด ๋’ค์— "&" ๋ถ™์ด๊ธฐ
    # ์‹คํ–‰ํ•œ terminal์ข…๋ฃŒ์‹œ jupyter notebook๋„ ํ•จ๊ป˜ ์ข…๋ฃŒ ๋จ
    $ jupyter notebook &
    
    • nohup ๋ช…๋ น์–ด ์‚ฌ์šฉ
    # ๊ธฐ๋ณธ ์‚ฌ์šฉ ๋ฒ•
    # terminal ์ข…๋ฃŒ์‹œ์—๋„ ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ ์•ˆ๋จ
    $ nohup jupyter notebook &
    # "nohup.out" ํŒŒ์ผ์ด ์ƒ์„ฑ๋˜๋ฉฐ ์ถœ๋ ฅ ์ €์žฅ
    
    # ๊ฐ•์ œ ์ข…๋ฃŒ ๋ฐฉ๋ฒ•
    $ ps aux | grep jupyter
    $ kill -i [PID]
    
    # nohup.out ํŒŒ์ผ ์ƒ์„ฑ ์•ˆํ•˜๊ณ  ์‹คํ–‰ํ•˜๋Š” ๋ฐฉ๋ฒ•
    $ nohup jupyter notebook >/dev/null 2>&1 &
    
  • build kernel ์ถ”๊ฐ€๋ฐฉ๋ฒ•

$ sudo apt-get install ipykernel
$ python -m ipykernel install --user --name [virtual env name] --display-name โ€œ[Display name on jupyter]โ€