Reputation: 1013
I just started using Julia and want to use different environments. So far, I have two environments in two different folders, both with IJulia
added to them and then different other packages. When starting Jupyter however, I only see one Julia version as a kernel (Julia 1.5.3)
.
For Python environments, I use nb_conda_kernels
, so Jupyter displays Python[conda env:root]
, Python[conda env:myEnv]
, etc. How do I achieve the same with Julia, so i can switch Kernels without switching directories and restarting Jupyter from a different directory?
Upvotes: 3
Views: 297
Reputation: 42214
Since IJulia is using Python you can just install nb_conda_kernels
for your Julia installation:
using PyCall, Conda
Conda.add("nb_conda_kernels")
Now you can use the Julia-inbuilt Python to execute any command you need. For an example:
julia> run(`$(PyCall.python) -m nb_conda_kernels list`)
[ListKernelSpecs] WARNING | Config option `kernel_spec_manager_class` not recognized by `ListKernelSpecs`.
[ListKernelSpecs] [nb_conda_kernels] enabled, 4 kernels found
Available kernels:
conda-root-py c:\juliapkg\julia-1.6.0-beta1\conda\3\share\jupyter\kernels\python3
conda-env-3-py c:\juliapkg\julia1.5.3\conda\3\share\jupyter\kernels\python3
conda-env-3-2-py c:\juliapkg\julia1.5.3\conda\3\share\jupyter\kernels\python3
conda-env-Anaconda3-py c:\programdata\anaconda3\share\jupyter\kernels\python3
julia-1.5 C:\Users\pszufe\AppData\Roaming\jupyter\kernels\julia-1.5
julia-1.6 C:\Users\pszufe\AppData\Roaming\jupyter\kernels\julia-1.6
julia-o3-1.5 C:\Users\pszufe\AppData\Roaming\jupyter\kernels\julia-o3-1.5
python3 C:\JuliaPkg\Julia-1.6.0-beta1\conda\3\share\jupyter\kernels\python3
Process(`'C:\JuliaPkg\Julia-1.6.0-beta1\conda\3\python.exe' -m nb_conda_kernels list`, ProcessExited(0))
Upvotes: 1