jupyter 托管_如何在本地托管的Jupyter Notebook上进行协作
jupyter 托管
背景故事 (Backstory)
Some while back I received a call from a good friend that is learning about Data Science and wanted some help. As we are often taught about Jupyter Notebooks when learning Data Science, it was not surprise that he was using a Jupyter Notebook, but this instantly stomped me. How are we going to collaborate on a Notebook?
?青梅前陣子我收到從正在了解數(shù)據(jù)科學(xué)的好朋友打個電話,想一些幫助。 當(dāng)我們在學(xué)習(xí)數(shù)據(jù)科學(xué)時經(jīng)常被教導(dǎo)有關(guān)Jupyter筆記本的信息時,他使用Jupyter筆記本并不奇怪,但是這立即使我tom腳。 我們?nèi)绾卧诠P記本上進(jìn)行協(xié)作?
We ended up doing a zoom call and he gave me authorization to control his screen, but the latency was turning me crazier than the problem at hand.
我們最終進(jìn)行了一次變焦通話,他給了我授權(quán)來控制他的屏幕,但是延遲使我變得比手頭的問題更瘋狂。
Fast-forward 2 months, the tables have turned, I am now the one in need. I reached out to a Senior Data Scientist (we will call him Billy for this article) and told him of my woes:
快進(jìn)了2個月,桌子已經(jīng)翻了,我現(xiàn)在是需要的那個。 我聯(lián)系了一位高級數(shù)據(jù)科學(xué)家(本文中稱他為Billy),并告訴他我的麻煩:
Billy: That’s fine, Do you want to do some pair programming?
比利 :很好,你想做一對編程嗎?
Me: Yes please that would be great. ** Sigh of relief **
我 :是的,那太好了。 ** 松了一口氣 **
Billy: Are you using Google Colabs?
比利:您在使用Google Colabs嗎?
Note: Turns out Colab is super easy to collaborate on.
注意:事實證明,Colab超級易于協(xié)作。
Me: No, I am using Jupyter Notebooks locally
我:不,我在本地使用Jupyter Notebooks
Billy: That’s fine. We can use Ngrok!
比利 :很好。 我們可以使用Ngrok !
Me: Ah yes, Sure!
我 :是的,當(dāng)然!
I will be totally honest… I had no clue what Ngrok was, but I had faith in my googling skills.
我會完全誠實的……我不知道Ngrok是什么,但是我對自己的谷歌搜索技術(shù)充滿信心。
恩格羅克 (Ngrok)
Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels. Subsequently, we are able to provide our local server to the port of a web server and this enables us to get the local address we specified — If this makes no sense to you, don’t worry about it. All I am saying is that we will obtain a public URL of our locally hosted Jupyter Notebook that we can share and use to collaborate.
Ngrok通過安全隧道將位于NAT和防火墻后面的本地服務(wù)器公開到公共Internet。 隨后,我們能夠?qū)⒈镜胤?wù)器提供給Web服務(wù)器的端口,這使我們能夠獲取我們指定的本地地址-如果這對您沒有意義,請不必?fù)?dān)心。 我要說的是,我們將獲得本地托管的Jupyter Notebook的公共URL,我們可以共享該URL并用于協(xié)作。
安裝Ngrok (Installing Ngrok)
Setting up Ngrok consist of 3 simple steps:
設(shè)置Ngrok包含3個簡單步驟:
Sign Up
注冊
You can easily make a free account by clicking on “Sign Up”. Just fill in your credentials and you’re fired up — Link to sign up page here
您可以通過單擊“注冊”輕松注冊一個免費帳戶。 只需填寫您的憑據(jù),您就會被解雇— 在此處鏈接以注冊頁面
2. Download
2. 下載
Download Ngrok that is suitable for your operating system then Unzip it once it’s downloaded.
下載適合您的操作系統(tǒng)的Ngrok,然后在下載后解壓縮。
Note: On Linux or Mac OS X you can unzip ngrok from a terminal with the following command. On Windows, just double click ngrok.zip to extract it.
注意:在Linux或Mac OS X上,可以使用以下命令從終端解壓縮ngrok。 在Windows上,只需雙擊ngrok.zip將其解壓縮。
unzip /path/to/ngrok.zip3. Connect your Account
3. 連接您的帳戶
The next step is simply authenticating your Ngrok agent, which only needs to be done once as the Authtoken is saved in the default configuration file.
下一步就是對您的Ngrok代理進(jìn)行身份驗證,僅需完成一次,因為Authtoken被保存在默認(rèn)配置文件中。
Your authentication token can be accessed by going to Authentication on the side bar then Your Authtoken — See image below.
可以通過以下方法訪問身份驗證令牌:轉(zhuǎn)到側(cè)欄上的身份驗證 ,然后轉(zhuǎn)到您的身份驗證令牌-參見下圖。
I prefer the command line set up which includes simply telling Ngrok your authentication token.
我更喜歡命令行設(shè)置,其中包括簡單地告訴Ngrok您的身份驗證令牌。
./ngrok authtoken 1g3Zd5XeTdmRTYIvOZmGVBW3hAH_2873ypJDaDf6ybyUzmSUjGreat! You are now all set up, but now you must learn to share your Jupyter Notebook.
大! 現(xiàn)在您已經(jīng)完成所有設(shè)置,但是現(xiàn)在您必須學(xué)習(xí)共享Jupyter Notebook。
共享筆記本 (Sharing the Notebook)
For Jupyter Notebooks to be accessed remotely we must make some adjustments to our Jupyter Notebook configuration, and for extra security, we will add a password.
為了可以遠(yuǎn)程訪問Jupyter Notebook,我們必須對Jupyter Notebook配置進(jìn)行一些調(diào)整,并且為了增加安全性,我們將添加一個密碼。
jupyter notebook --generate-configThis will return the link address to the configuration file of your Jupyter Notebook.
這會將鏈接地址返回到Jupyter Notebook的配置文件。
Writing default config to: C:\Users\Kurtis\.jupyter\jupyter_notebook_config.pyCopy the link address and run the following command
復(fù)制鏈接地址并運行以下命令
echo "NotebookApp.allow_remote_access = True" >> C:\Users\Kurtis\.jupyter\jupyter_notebook_config.pyThen we add a password…
然后我們添加密碼...
jupyter notebook passwordWe now have everything required to run and connect our Jupyter Notebook so that it could be shared remotely.
現(xiàn)在,我們擁有運行和連接Jupyter Notebook所需的一切,以便可以遠(yuǎn)程共享它。
Tip: In the next part we’ll need two separate terminals connected to our remote because once we run jupyter, it will occupy a window with logging. You can either open a second terminal and ssh into it again, or you can use a tool like tmux to manage them within a single terminal. (Source: ArtificialSoph Github)
提示 :在下一部分中,我們需要將兩個獨立的終端連接到我們的遙控器,因為一旦運行jupyter,它將占據(jù)一個帶有日志記錄的窗口。 您可以打開第二個終端并再次SSH進(jìn)入,也可以使用tmux之類的工具在單個終端中進(jìn)行管理。 (來源: ArtificialSoph Github )
Open your Jupyter Notebook by typing jupyter notebook in your terminal.
通過在終端中鍵入jupyter notebook ,打開Jupyter筆記本。
jupyter notebookAfter we’ve accessed our Jupyter Notebook we tell Ngrok what port our web server is listening on.
訪問Jupyter Notebook后,我們告訴Ngrok Web服務(wù)器正在監(jiān)聽的端口。
The above image highlights the port. Thence we would tell Ngrok the port is 8888.
上圖突出顯示了端口。 因此,我們將告訴恩格羅克港口是8888。
ngrok http [port] -host-header="localhost:[port]"Your results should look like the one displayed below
您的結(jié)果應(yīng)如下所示
Copy the forwarding address and share it with whoever you want to collaborate with — if you followed our steps and set up a password then you’ll have to tell them the password.
復(fù)制轉(zhuǎn)發(fā)地址并與任何您想與之合作的人共享-如果您按照我們的步驟操作并設(shè)置了密碼,則必須告訴他們該密碼。
Great, now you can collaborate!
太好了,現(xiàn)在您可以合作!
結(jié)論 (Conclusion)
Magnificent! Now you don’t have to be stomped or put up with bad latency (because you’ve shared your screen on zoom) whenever you need to collaborate with someone on a Jupyter Notebook on their local machine (or yours for that matter) — You now know how to share your Jupyter Notebook and work on a different machine.
壯麗的! 現(xiàn)在,當(dāng)您需要與本地計算機上的Jupyter Notebook上的某人(或與此相關(guān)的您)進(jìn)行協(xié)作時,您不必再為步履蹣跚或忍受嚴(yán)重的延遲(因為您已經(jīng)共享了縮放屏幕)。現(xiàn)在,您知道如何共享Jupyter Notebook和在其他計算機上工作。
I enjoy connecting with people, I am most reachable on LinkedIn — Connect and stay up to date with anything new I am learning (and feel free to share what you’re learning too).
我喜歡與人交流,我在LinkedIn上的聯(lián)系方式最廣泛-與我學(xué)習(xí)的任何新事物保持聯(lián)系并保持最新(并隨時分享您所學(xué)的內(nèi)容)。
翻譯自: https://towardsdatascience.com/how-to-collaborate-on-your-locally-hosted-jupyter-notebook-28e0dcd8aeca
jupyter 托管
總結(jié)
以上是生活随笔為你收集整理的jupyter 托管_如何在本地托管的Jupyter Notebook上进行协作的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 问道手游每周探案迷仙镇案踪怎么做 每周探
- 下一篇: fitbit手表中文说明书_如何获取和分