# How to Run Jupyter Notebooks Online on Windows
##### `Jupyter` `python` `ngrok`
> [name=Mr. Akashic] [time=Mon, Sept 11, 2023]
## Prerequisites
[Install Python 3.x (preferably the latest version)](https://www.python.org/downloads/)
[Install virtualenv & Activate](https://hackmd.io/@JGoK5hXkSQuAC32KMw8hHw/HJPhAZSjh)
## Get Hands Dirty
### Step 1. Download [ngrok](https://ngrok.com/download) & Run
在Windows下載ngrok會是一個壓縮檔,解壓縮後,就是一個ngrok的執行檔。
1. [Connect your agent to your ngrok account](https://dashboard.ngrok.com/login)
登入後,取得一個authtoken,然後在terminal執行下面指令。
```bash=
ngrok config add-authtoken $TOKEN
```
2. Start ngrok
Start ngrok by running the following command.
8000 port根據妳的需要修改。
```bash=
ngrok http 8000
```
3. 成功執行畫面

:::info
:warning: **注意:**
每次重新執行ngrok,網址就會更新,不會和之前的一模一樣。
:::
### Step 2. Install Jupyter Notebook
1. Install Jupyter & the IPython Kernel by running the following command.
```python=
pip install jupyter
pip install ipykernel
```
2. Register the Kernel with Jupyter
```python=
python -m ipykernel install --user --name=my-python3-kernel
```
3. Generate Jupyter Notebook configuration file, run the following command:
```python=
jupyter notebook --generate-config
**output**
Writing default config to: C:\Users\RCSL\.jupyter\jupyter_notebook_config.py
```
4. Open the configuration file and set the parameter <span class="dark_orange">c.ServerApp.allow_remote_access</span> to True

5. Launch the Jupyter Notebook application & ***copy the token***.
```python=
jupyter notebook
```

6. Access Jupyter Notebook remotely
Open the ngrok URL in you browser and you’ll be redirected to the Jupyter Notebook application running on the local machine.

7. Paste the copied token that in no.4 and log in.

8. That’s it! we can now access Jupyter Notebook running on the local machine from any remote machine as long as it’s connected to the Internet.

<style>
.dark_orange {
color: #FF8C00;
background:#F6F6F6;
border-radius:4px;
padding-right:6px;
padding-left:6px;
}
</style>
## Acknowledgements
1. [Setup Jupyter Notebook on your Local Machine and use it from Anywhere using this Tool](https://levelup.gitconnected.com/setup-jupyter-notebook-on-your-local-machine-and-use-it-from-anywhere-using-this-tool-4f43e8165586)
2. [How to Add a Python 3 Kernel to Jupyter IPython](https://saturncloud.io/blog/how-to-add-a-python-3-kernel-to-jupyter-ipython/)
3. [jupyter notebook 遠端連線(文章最後有小撇步)](https://joechang0113.github.io/2020/03/23/jupyter-notebook-and-ngrok.html)