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

Julia kernel is not found anymore from 1.3 to 1.4 update when available through Conda.jl #8573

Open
cderv opened this issue Feb 2, 2024 · 8 comments
Assignees
Labels
bug Something isn't working julia jupyter
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Feb 2, 2024

This was reported in quarto-dev/quarto-actions#98

Simple document:

---
title: test
jupyter: julia-1.10
---

```{julia}
1 + 1
```

Only Julia is available no python, and it is configured using https://quarto.org/docs/computations/julia.html#installation

using Pkg
Pkg.add("IJulia")
using IJulia
notebook()

Using quarto render test.qmd will throw an error

quarto render test.qmd
Check file:///quarto-cli/src/quarto.ts
ERROR: Jupyter kernel 'julia-1.10' not found.

Stack trace:
    at jupyterKernelspecFromMarkdown (file:///quarto-cli/src/core/jupyter/jupyter.ts:514:9)
    at async quartoMdToJupyter (file:///quarto-cli/src/core/jupyter/jupyter.ts:281:34)
    at async createNotebookforTarget (file:///quarto-cli/src/execute/jupyter/jupyter.ts:551:14)
    at async Object.target (file:///quarto-cli/src/execute/jupyter/jupyter.ts:183:12)
    at async fileExecutionEngineAndTarget (file:///quarto-cli/src/execute/engine.ts:213:18)
    at async renderFileInternal (file:///quarto-cli/src/command/render/render-files.ts:429:32)
    at async renderFiles (file:///quarto-cli/src/command/render/render-files.ts:310:9)
    at async render (file:///quarto-cli/src/command/render/render-shared.ts:87:18)
    at async Command.fn (file:///quarto-cli/src/command/render/cmd.ts:212:26)
    at async Command.execute (file:///quarto-cli/src/vendor/deno.land/x/cliffy@v0.25.4/command/command.ts:1790:7)

it is working in 1.3.450 but fails this way with new 1.4 version

@cderv cderv self-assigned this Feb 2, 2024
@cderv
Copy link
Collaborator Author

cderv commented Feb 2, 2024

Digging into this here is what happens :

Using Built conda was adding in this PR

It worked in "default" way

if (!jupyterCapsCache.has(language)) {
// if we are targeting julia then prefer the julia installed miniconda
const juliaCaps = await getVerifiedJuliaCondaJupyterCapabilities();
if (language === "julia" && juliaCaps) {
jupyterCapsCache.set(language, juliaCaps);
return juliaCaps;
}

juliacaps was always computed, and was supposed to be set for language Julia in kernel spec

At first detection, when jupyterCapsCache is filled in our process, I don't think language is ever set (but unsure about that). So what happened is that - in case no other python install is found, the Julia Conda installation was supposed to be used a the default one for language (none)

// if the version we discovered doesn't have jupyter and we have a julia provided
// jupyter then go ahead and use that
if (!jupyterCapsCache.get(language)?.jupyter_core && juliaCaps) {
jupyterCapsCache.set(language, juliaCaps);
}

During 1.4, this was change in two commits ab5722f...48795e9 so that it "Only search for Julia conda installation when the engine language is Julia"

My understanding is juliacaps is no more check at first detection as in 1.3 and this is no more set

// if the version we discovered doesn't have jupyter and we have a julia provided
// jupyter then go ahead and use that
if (!jupyterCapsCache.get(language)?.jupyter_core && juliaCaps) {
jupyterCapsCache.set(language, juliaCaps);
}

So when kernelspec from Markdown is checked and see julia-1.10, it will check the capabilities - there will be no language information, and so there will be none found

} else if (typeof (yamlJupyter) === "string") {
const kernel = yamlJupyter;
const kernelspec = await jupyterKernelspec(kernel);
if (kernelspec) {
return [kernelspec, {}];
} else {
return Promise.reject(
new Error("Jupyter kernel '" + kernel + "' not found."),
);
}

I don't know the context of ab5722f...48795e9 changes so I need to understand further for a correct fix, but the logic for Julia detection needs to be adapted for this specific case.

@jjallaire do you remember about those commits and why "Only search for Julia conda installation when the engine language is Julia" ? Was there an issue with previous logic ?

Also I am not sure when language should be set to Julia and so Julia conda found.

@cderv cderv added the bug Something isn't working label Feb 2, 2024
@cderv cderv added this to the v1.5 milestone Feb 2, 2024
@runjaj
Copy link

runjaj commented Feb 4, 2024

Have you updated Julia to 1.10 recently? If you have, you need to run this command:

Pkg.build("IJulia")

See: Updating Julia and IJulia

I’m not sure if this is the problem, but I know that it has solved me these kinds of problems (kernel not found) before.

@cderv
Copy link
Collaborator Author

cderv commented Feb 5, 2024

Thanks @runjaj ! That is good advice indeed ! In most case, IJulia needs to be rebuild so that it finds Jupyter and configure kernel.

Though I do believe here that the issue is happening because of how quarto tries to determine kernel. I reproduced and searched through our code as documented above.

This is exclusively happening when no python installation on the system and Conda.jl only is used.

@cderv

This comment was marked as resolved.

@cscheid

This comment was marked as resolved.

@cderv

This comment was marked as resolved.

@Lightup1
Copy link

Is there a quick solution at the current status? I just followed the document to install IJulia and find that Quarto cannot find julia kernel but jupyter kernelspec list says julia-1.10 is available.

@Lightup1
Copy link

Lightup1 commented Mar 26, 2024

I just removed the python that quarto was using, then the quarto can find the julia kernel.
However, it still keeps warning me that "Specified QUARTO_PYTHON 'C:\Python312\python.exe' does not exist".
Actually, I checked my system environment there is no parameter named QUARTO_PYTHON.

Warning disappears after reboot the machine.

@cderv cderv modified the milestones: v1.5, v1.6 Jun 19, 2024
@cscheid cscheid modified the milestones: v1.6, v1.7 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working julia jupyter
Projects
None yet
Development

No branches or pull requests

4 participants