While Korg is written in Julia, it's possible to use it from either Julia or Python.
Using Korg from Julia
1. Install Julia
Install Julia, by following the (instructions on the website.
The latest versions of Korg support Julia 1.7 and greater, so make sure you are not using an older version. (Versions can be installed alongside eachother, and the 1.X versions are backwards compatible.)
2. Install Korg
- Launch a julia session (either by launching the app, or typing
julia
on the command line if you have that set up). - Type
]
to enterPkg
mode. - Type
add Korg
to install Korg and its dependencies. - Press backspace or
CTRL+C
to exitPkg
mode (and return to the Julia REPL)
Alternatively, you can run
julia> using Pkg
julia> Pkg.add("Korg")
If you are coming from Python, we also recommend installing IJulia (for using Julia from Jupyter/IPython notebooks), and PythonPlot (for calling matplotlib
from Julia).
Using Korg from Python
The recommended way to call Korg from Python is to use juliacall. Here's the quick version:
Install juliacall with
pip install juliacall
pip install juliapkg
Then, to install Korg, do this from a Python shell:
import juliapkg
juliapkg.add("Korg", "acafc109-a718-429c-b0e5-afd7f8c7ae46")
juliapkg.resolve()
That's it! To use Korg from Python, just put these lines at the top of your script/notebook.
from juliacall import Main as jl
jl.seval("using Korg")
Korg = jl.Korg
Keeping Korg updated
In order to update Korg in the future, you can type:
Julia:
using Pkg
Pkg.update("Korg")
Python:
from juliacall import Main as jl
jl.seval("using Pkg")
jl.Pkg.update("Korg")