AtelierArith / intro2software_with_julia

計算物理春の学校ソフトウェア入門講義のスライド格納リポジトリ
https://atelierarith.github.io/intro2software_with_julia/
2 stars 7 forks source link

Pluto.jl ノートブックのリンクから JuliaHub で起動するまでの手順を説明する #5

Open terasakisatoshi opened 5 months ago

terasakisatoshi commented 5 months ago

Pluto Notebook を JuliaHub で動かす方法をステップバイステップで解説する

terasakisatoshi commented 5 months ago

教材を動かすために教材のソースコードを公開しないといけないということに気づく.

terasakisatoshi commented 5 months ago

まずそれから始める(´・ω・`)

terasakisatoshi commented 5 months ago

Pluto.jl notebook シリーズは公開した

https://github.com/AtelierArith/intro2software_with_julia_pluto_materials

hello.jl を実行する方法を書く

terasakisatoshi commented 5 months ago

JuliaHub アカウント作成

JuliaHub ホームページ https://juliahub.com/ に移動

image

Start for Free のボタンを押す.下記のような画面に遷移する

image

ここでは GitHub アカウントと紐付ける. 実際はどれでもいいがここでは Continue with GitHub をクリックする.

terasakisatoshi commented 5 months ago

Pluto.jl を JuliaHub 上で動かす

image

Pluto.jl と書いてあるカード内にある Launch をクリックする.

JuliaSim Pluoto というアプリケーションもあるが,Pluto.jl が使えれば良いのでどっちでも良い.

image

素朴な環境は Pluto Run Pluto notebooks in the cloud の方だと思う.

Launch -> Connect

Launch ボタンを押すと,対応するアプリケーションのインスタンスが起動する.Launch から Connect に変更されることに注意.

image

Connect ボタンを押すと次の画面に遷移する.

Your session has expired という画面が出るが,気にせず Log in ボタンを押す

image

再び JuliaHub ログイン画面に移動する.アカウント登録する際に用いた Continue with xxx と同じものを選べば良い.(ここでは Continue with GitHub を選択する)

image

Connecting to your application という画面が出る.しばらく待機.

image

下記のように welcome to Pluto.jl を含む画面が出たら成功

image
terasakisatoshi commented 5 months ago

JuliaHub は月 20 時間無料で使える.ハンズオンのみであれば十分使える.

terasakisatoshi commented 5 months ago

ノートブックの URL をコピーする

https://atelierarith.github.io/intro2software_with_julia_pluto_materials/ に移動する.下記のような素朴な画面に移動する.

image

我々は hello を動かしたいとする.hello をクリック.

下記のような画面に遷移する.

image

全てのセルが評価されたノートブックが見える.

画面右上の Edit or run this notebook ボタンをクリック.少しスクロールすると On your computer というセクションが見つかる.Copy the notebook URL 直下にある URL をコピーする.

image

コピーした結果は次のようになる:

https://atelierarith.github.io/intro2software_with_julia_pluto_materials/hello.jl
terasakisatoshi commented 5 months ago

既存のノートブックを JuliaHub で実行させる.

再び JuliaHub で起動した Pluto Notebook 環境に戻る.

Open from URL の欄に先ほどコピーした URL を貼り付ける.

image

Open ボタンをクリックする.

結構時間がかかる.

image

しばらくすると次のような画面に移動する

image

念の為コードの中に悪意のあるものがないか確認し Run notebook code ボタンを押す.

image

ここでは危害がないノートブックであることを信じ OK ボタンを押す.

ノートブックの実行にしばらく時間がかかるが,一旦起動すればサクサク動く.

terasakisatoshi commented 5 months ago

これによりローカル環境で環境構築が失敗しても JuliaHub の上でコードを実行させることができる.Julia が直接入らないが,ブラウザがある環境で利用できる.