I cannot use Julia kernel in Jupyter Notebook/Jupyter lab after updating to Julia 1.9.0

I have installed Jupyter Lab, and IJulia. Now if I do
$ jupyter lab,
I get to see the Jupyter Lab web interface, where

if I select “Julia-1.9.0 kernel”, the kernel does not load, and in the terminal I see the following message:

// — error message

"[ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]
ERROR: LoadError: ArgumentError: Package Preferences [21216c6a-2e73-6563-6e65-726566657250] is required but does not seem to be installed:

  • Run Pkg.instantiate() to install all recorded dependencies.
    —//

Running Pkg.instantiate() does not result in any error message but it does not help to solve the problem.

I have checked and the Package Preferences is installed.

Jupyter Notebook/Lab Julie kernel is now unusable.

Julia works otherwise.
What am I doing wrongly and how can I solve this problem?
Would greatly appreciate a solution.

Best,
Arindam Basu

What version of IJulia are you running?

What happens if you run lab through IJulia, e.g.

using IJulia
jupyterlab()
1 Like

It doesn’t connect if run with using IJulia; jupyterlab().
It spawns jupyterlab interface but the kernel does not connect.

Have you check the install instructions for IJulia? There are some notes on stuff you should think of when using separate jupyter installations (not sure if you do this?) or if you update Julia/IJulia.

Maybe just try to reinstall or rebuild IJulia, and make sure the kernelspec is appropriately updated?

I have encountered a similar problem only in notebook. I couldn’t fix the error, but I started using jupyter notebook in visual code. In this case, everything worked.
Errors in my case:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\web.py", line 1704, in _execute
    result = await result
  File "C:\ProgramData\Anaconda3\lib\asyncio\tasks.py", line 328, in __wakeup
    future.result()
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 74, in post
    model = yield maybe_future(
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 98, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 110, in start_kernel_for_session
    kernel_id = yield maybe_future(
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\lib\asyncio\futures.py", line 201, in result
    raise self._exception
  File "C:\ProgramData\Anaconda3\lib\asyncio\tasks.py", line 256, in __step
    result = coro.send(None)
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 176, in start_kernel
    kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 341, in start_kernel
    self.kernel = self._launch_kernel(kernel_cmd, **kw)
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 249, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\launcher.py", line 132, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The specified file cannot be found

I don’t know how to use Jupyter note directly , because I use Quarto qmd, but I think same problem

Problem is: maybe you delete old version Julia, but you don’t delete old version kernel in Python env.

Firstly I solved this problem in Quarto note by add Jupyter=Julia 1.9 .
then, I find another way follow this link :list jupyter kernel and delete kernel . So I delete old jupyter kernel, just keep the newest one. after delete old kernel ,like this:

$jupyter kernelspec remove julia-1.8

$ jupyter kernelspec list
Available kernels:
  julia-1.9    /Users/lunarcheung/Library/Jupyter/kernels/julia-1.9
  python3      /Users/lunarcheung/Library/Jupyter/kernels/python3

maybe another way to change default kernel , but I can’t find this way at now.

using IJulia; 
notebook() 

Yes, I followed every instruction in IJulia.
I completely uninstalled (that is, removed the .julia folder and every trace of Julia in my computer) and then reinstalled Julia. Then I installed IJulia with Pkg.add("IJulia"); Pkg.build("IJulia"); Pkg.instantiate(); Pkg.resolve() (many of these steps are unnecessary but I did them anyway!!)
I completely removed Anaconda from my computer and then reinstalled Mambaforge following the instructions. I removed every trace of Conda/Anaconda/Mamba from my computer including references in ~/.zshrc and then reinstalled everything. Then I installed julia in mamba in an environment and in that environment I installed IJulia.

Nothing helped.
If I were to fire up jupyter lab and selected the Julia-1.9.0 kernel within the Jupyter Lab, it would not start! Each time it reported “Preferenes is required but not found” which is not true because Preferences package is installed. Despite Zeromq, Zeromq_jll, and JLL packages installed, it would not precompile and it did not work.
I never faced this problem ever before.
Strangely enough, as @Sergey_Novak has written, I had the same experience. I can use jupyter notebook from VSCode but not from a web browser.

What more do I need to do?

I have had the same experience.
If I use file.ipynb in VSCode, and set Julia Release Channel, things work as they should and no issues.
IJulia does not seem to work if I use it in the context of a web browser based implementation of Jupyter Notebook. On the Jupyter Notebook, all other kernels work as usual.

Do you use the built in kernel in vscode, or the same kernel as in the browser?

Can you check the kernel spec file an see if there is anything strange added there?

I am sure I am using the built in kernel of the VScode, and there is nothing unusual in the the output of Jupyter kernelspec list.
This problem is unique to the MacBook I use.

But if you use the built in kernel in vscode, and that works, doesn’t that make it seem like it could be a problem with the kernel?
Can you try the other kernel in vscode, the one you tried in the browser?

Yes, it IS the julia kernel that is the problem.
When I used the Julia-1.9.0 kernel in the VSCode, it did not work and showed the same error messages.
What is the solution?

Thanks @albheim
OK, it seems that if I do:

using IJulia
installkernel("Julia nodeps", "--depwarn=no")

then start jupyter and select Julia-1.9.0-nodeps, it runs as it should.

2 Likes

I’ve had the same problem with Julia 1.9.2 on an Intel based Mac Pro (aka cheese grater).
This solution of installing the kernel with depwarn=no seems to solve the problem.

But, I suspect this is going to be an obstacle for many people. I’ve had trouble getting Julia 1.9 working with Jupyter on 3 machines.

Still is a problem when upgrading to Julia 1.10.2. But the trick by @arinbasu works.