Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify an environment containing IJulia *only* when started via kernel #1059

Open
pdeffebach opened this issue Nov 16, 2022 · 3 comments
Open

Comments

@pdeffebach
Copy link

My understanding is that currently, as long as Julia is listed on the kernel file, you can do

jupyer lab --kernel=julia-1.8

but if your Julia 1.8 environment doesn't have IJulia, the kernel will hang / throw an error.

Would it be possible to push! an environment contiaining only IJulia to the LOAD_PATH when Julia is started via the kernel? This could be done in the kernel initialization script, right?

I understand that pushing to LOAD_PATH is generally not recommended. Perhaps there is a way to do this with stacked environments as well.

@fortunewalla
Copy link

fortunewalla commented Dec 20, 2022

I don't know if this will help you but in the your jupyter kernels folder, and in that, within that in the julia-1.8 folder, there is a file called kernel.json.

For WIndows:
C:\Users\<username>\AppData\Roaming\jupyter\kernels\julia-1.8\kernel.json

So if you want jupyter to use the IJulia installed in juljup environment

Just change the --project path to make jupyter start from the juljup environment

original kernel.json

{
  "display_name": "Julia 1.8.3",
  "argv": [
    "C:\\julia\\bin\\julia.exe",
    "-i",
    "--color=yes",
    "--project=@.",
    "C:\\julia\\.julia\\packages\\IJulia\\AQu2H\\src\\kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "message"
}

modified --project to use IJulia from the juljup environment only

{
  "display_name": "Julia 1.8.3",
  "argv": [
    "C:\\julia\\bin\\julia.exe",
    "-i",
    "--color=yes",
    "--project=juljup",
    "C:\\julia\\.julia\\packages\\IJulia\\AQu2H\\src\\kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "message"
}

Hope this helps in some way.

@pdeffebach
Copy link
Author

Wonderful! This works, thanks.

Would be great if this were a default somehow, given its not great to clutter your global project.

@fortunewalla
Copy link

Wonderful! This works, thanks.

Would be great if this were a default somehow, given its not great to clutter your global project.

I'm a beginner in Julia but for some reason, it won't work even if the default project path is specified in the OS Environment; as juljup. i.e. JULIA_PROJECT=c:\julia\juljup

I suspect it has to do with the stage when IJulia creates the kernel. Perhaps it doesn't read the project environment but installs the kernal using the default Julia path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants