# Jupyter notebook setup: installation and remote access
###### tags: `shared` `python` `jupyter`
[TOC]
## Jupyter notebook installation
+ Simply with `pip3 install jupyter` and it will finish all installation for related packages
+ After installation, use `juptyer notebook` to open it through the browser (automatically opened with your default browser)
+ To open in another browser, use `localhost:<port>` instead
+ Detailed information should be available in the terminal prompt and can be modified through config
+ To close the jupyter notebook
+ Close the browser
+ `Ctrl+C` in the terminal
## Jupyter remote access: server settings
+ To access files and run python scripts on a remote server through `ssh` (the following steps should be done on the *server* side)
+ Use `jupyter notebook --generate-config` to generate default configuration files
+ Use `vim` to open the generated configuration file (should be something like `/home/user/.jupyter/jupyter_notebook_config.py`)
+ Search for `c.NotebookApp.open_browser` and set it to `False` (in this case it will not open the browser when activating the jupyter notebook)
+ Find `c.NotebookApp.port` and set it to new port number
+ Run `jupyer notebook` and the server is ready to be connected remotely
+ Some information available here: https://www.itread01.com/content/1544686040.html?fbclid=IwAR2-VokBr0METOPj5-U9OKag_gfieujCoKgiSgqAXFrfXHrQZeF6J2SprMs
## Jupyter remote access: client side
+ `ssh -N -L <port>:localhost:<port> <user_name>@<server_ip>`
+ `port` is the port number set on the server side
+ `user_name` and `server_ip` are the ones for the user on the server
+ The browser should open automatically and you're ready for runing scripts
## Conflicts with `argparse`
+ If your code uses `argparse`, it will report an error saying that the `-f` argument is not recognized
+ An easy way to alleviate this problem
+ Originally from: https://stackoverflow.com/questions/48796169/how-to-fix-ipykernel-launcher-py-error-unrecognized-arguments-in-jupyter
+ Complete code example in: https://qiita.com/LittleWat/items/6e56857e1f97c842b261
+ The idea is to bypass `argparse` with `easydict`
+ Just define your arguments in the form of `easydict` and the original code could be run without any revision