lab
lab copied to clipboard
[julia][pluto] Add guide for Julia (and Pluto Notebook)
https://julialang.org/
https://github.com/fonsp/Pluto.jl
Here are my notes.
[isabell@stardust ~]$ mkdir julia
[isabell@stardust ~]$ cd julia
[isabell@stardust julia]$ curl https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.2-linux-x86_64.tar.gz | tar zxf - --strip-components=1
[isabell@stardust julia]$ ln --symbolic --verbose ~/julia/bin/julia ~/bin/julia
‘/home/isabell/bin/julia’ -> ‘/home/isabell/julia/bin/julia’
[isabell@stardust julia]$ cd
[isabell@stardust ~]$
then start julia and then press ]
to enter the package manager
[isabell@stardust ~]$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.2 (2021-07-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> ]
(@v1.6) pkg> add Pluto
Installing known registries into `~/.julia`
Added registry `General` to `~/.julia/registries/General`
Resolving package versions...
Installed DataValueInterfaces ───────── v1.0.0
Installed IteratorInterfaceExtensions ─ v1.0.0
Installed MbedTLS ───────────────────── v1.0.3
Installed Configurations ────────────── v0.16.4
Installed OrderedCollections ────────── v1.4.1
Installed URIs ──────────────────────── v1.3.0
Installed ExproniconLite ────────────── v0.6.9
Installed IniFile ───────────────────── v0.5.0
Installed FuzzyCompletions ──────────── v0.4.3
Installed DataAPI ───────────────────── v1.8.0
Installed TableIOInterface ──────────── v0.1.6
Installed TableTraits ───────────────── v1.0.1
Installed Tables ────────────────────── v1.5.2
Installed Pluto ─────────────────────── v0.16.0
Installed HTTP ──────────────────────── v0.9.14
Installed MsgPack ───────────────────── v1.1.0
Updating `~/.julia/environments/v1.6/Project.toml`
[c3e4b0f8] + Pluto v0.16.0
Updating `~/.julia/environments/v1.6/Manifest.toml`
[5218b696] + Configurations v0.16.4
[9a962f9c] + DataAPI v1.8.0
[e2d170a0] + DataValueInterfaces v1.0.0
[55351af7] + ExproniconLite v0.6.9
[fb4132e2] + FuzzyCompletions v0.4.3
[cd3eb016] + HTTP v0.9.14
[83e8ac13] + IniFile v0.5.0
[82899510] + IteratorInterfaceExtensions v1.0.0
[739be429] + MbedTLS v1.0.3
[99f44e22] + MsgPack v1.1.0
[bac558e1] + OrderedCollections v1.4.1
[c3e4b0f8] + Pluto v0.16.0
[d1efa939] + TableIOInterface v0.1.6
[3783bdb8] + TableTraits v1.0.1
[bd369af6] + Tables v1.5.2
[5c2747f8] + URIs v1.3.0
[0dad84c5] + ArgTools
[56f22d72] + Artifacts
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8ba89e20] + Distributed
[f43a241f] + Downloads
[7b1f6079] + FileWatching
[b77e0a4c] + InteractiveUtils
[b27032c2] + LibCURL
[76f85450] + LibGit2
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[56ddb016] + Logging
[d6f4376e] + Markdown
[ca575930] + NetworkOptions
[44cfe95a] + Pkg
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA
[9e88b42a] + Serialization
[6462fe0b] + Sockets
[fa267f1f] + TOML
[a4e569a6] + Tar
[8dfed614] + Test
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
[deac9b47] + LibCURL_jll
[29816b5a] + LibSSH2_jll
[c8ffd9c3] + MbedTLS_jll
[14a3606d] + MozillaCACerts_jll
[83775a58] + Zlib_jll
[8e850ede] + nghttp2_jll
[3f19e933] + p7zip_jll
Precompiling project...
19 dependencies successfully precompiled in 46 seconds
(@v1.6) pkg>
Create the file ~/pluto-run.jl
with the following content:
using Pluto
Pluto.run(host="0.0.0.0", launch_browser=false)
Before you start the server run uberspace web backend set / --http --port 1234
start julia/Pluto
Just for testing this ...
[isabell@stardust ~]$ julia pluto-run.jl
Go to http://0.0.0.0:1234/?secret=YldTioK7 in your browser to start writing ~ have fun!
Press Ctrl+C in this terminal to stop Pluto
Create a service file at ~/etc/services.d/pluto.ini
[program:pluto]
directory=%(ENV_HOME)s/
command=julia pluto-run.jl
startsecs=60
autostart=yes
autorestart=yes
Run supervisorctl reread
and supervisorctl update
With supervisorctl tail -f pluto
you can look up your secret.
You actually have to point your browser to something like this isabell.uber.space/?secret=YldTioK7
install kernel for jupyter notebook
As an alternative If you want to use it with jupyter notebook you can install the kernel.
[isabell@stardust ~]$ julia
(@v1.6) pkg> add IJulia
Installed ZeroMQ_jll ────── v4.3.4+0
Installed VersionParsing ── v1.2.0
Installed SoftGlobalScope ─ v1.1.0
Installed Conda ─────────── v1.5.2
Installed ZMQ ───────────── v1.2.1
Installed IJulia ────────── v1.23.2
Installed JLLWrappers ───── v1.3.0
Installed Preferences ───── v1.2.2
Installed Parsers ───────── v2.0.3
Installed JSON ──────────── v0.21.2
Downloaded artifact: libsodium
Downloaded artifact: ZeroMQ
Updating `~/.julia/environments/v1.6/Project.toml`
[7073ff75] + IJulia v1.23.2
Updating `~/.julia/environments/v1.6/Manifest.toml`
[8f4d0f93] + Conda v1.5.2
[7073ff75] + IJulia v1.23.2
[692b3bcd] + JLLWrappers v1.3.0
[682c06a0] + JSON v0.21.2
[69de0a69] + Parsers v2.0.3
[21216c6a] + Preferences v1.2.2
[b85f4697] + SoftGlobalScope v1.1.0
[81def892] + VersionParsing v1.2.0
[c2297ded] + ZMQ v1.2.1
[8f1865be] + ZeroMQ_jll v4.3.4+0
[a9144af2] + libsodium_jll v1.0.20+0
[a63ad114] + Mmap
Building Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/299304989a5e6473d985212c28928899c74e9421/build.log`
Building IJulia → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/d8b9c31196e1dd92181cd0f5760ca2d2ffb4ac0f/build.log`
Precompiling project...
7 dependencies successfully precompiled in 10 seconds (23 already precompiled)
(@v1.6) pkg> ^C
julia > exit()
[isabell@stardust ~]$
update
manual update
Start julia
and then press ]
to enter the package manager. With the update
command you can start the process. Then you can exit with Ctrl + C
and exit()
[isabell@stardust ~]$ julia
(@v1.6) pkg> update
Updating registry at `~/.julia/registries/General`
No Changes to `~/.julia/environments/v1.6/Project.toml`
No Changes to `~/.julia/environments/v1.6/Manifest.toml`
(@v1.6) pkg> ^C
julia > exit()
[isabell@stardust ~]$
update script
As a julia script create ~/julia-update.jl
so you can run julia ~/julia-update.jl
:
using Pkg
Pkg.update()
Create ~/bin/julia-update
with the following content:
#!/usr/bin/env bash
julia ~/julia-update.jl
[isabell@stardust ~]$ chmod u+x ~/bin/julia-update
[isabell@stardust ~]$ julia-update
Updating registry at `~/.julia/registries/General`
Installed DataAPI ──────── v1.9.0
Installed Parsers ──────── v2.0.6
Installed Configurations ─ v0.16.6
Installed Tables ───────── v1.6.0
Installed ExproniconLite ─ v0.6.12
Installed HTTP ─────────── v0.9.16
Installed Pluto ────────── v0.16.1
Updating `~/.julia/environments/v1.6/Project.toml`
[c3e4b0f8] ↑ Pluto v0.16.0 ⇒ v0.16.1
Updating `~/.julia/environments/v1.6/Manifest.toml`
[5218b696] ↑ Configurations v0.16.4 ⇒ v0.16.6
[9a962f9c] ↑ DataAPI v1.8.0 ⇒ v1.9.0
[55351af7] ↑ ExproniconLite v0.6.9 ⇒ v0.6.12
[cd3eb016] ↑ HTTP v0.9.14 ⇒ v0.9.16
[69de0a69] ↑ Parsers v2.0.3 ⇒ v2.0.6
[c3e4b0f8] ↑ Pluto v0.16.0 ⇒ v0.16.1
[bd369af6] ↑ Tables v1.5.2 ⇒ v1.6.0
Precompiling project...
10 dependencies successfully precompiled in 21 seconds (20 already precompiled)
[isabell@stardust ~]$
Have fun 🚀