JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.8k stars 413 forks source link

julia Current stable release: v1.10.3 (April 30, 2024) kernel fails to connect in IJulia jupyter #1112

Open proudindiv opened 6 months ago

proudindiv commented 6 months ago

I've used many releases of julia over several years. The latest one fails with:

Connection failed

A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.

The older prior one still works fine, with versioninfo() in a juypter cell giving:

Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-6770HQ CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

Here is my installation of julia-1.10.3 from repl:

gary@nuc04:~$ which julia-1.10.3
/usr/local/bin/julia-1.10.3
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.3 (2024-04-30)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a5507 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-6770HQ CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

(@v1.10) pkg> update IJulia
    Updating registry at `~/.julia/registries/General.toml`
  No Changes to `~/.julia/environments/v1.10/Project.toml`
  No Changes to `~/.julia/environments/v1.10/Manifest.toml`

(@v1.10) pkg> status IJulia
Status `~/.julia/environments/v1.10/Project.toml`
  [7073ff75] IJulia v1.24.2

julia> installkernel("julia-1.10.3","julia-1.10.3")
[ Info: Installing julia-1.10.3 kernelspec in /home/gary/.local/share/jupyter/kernels/julia-1.10.3-1.10
"/home/gary/.local/share/jupyter/kernels/julia-1.10.3-1.10"

julia> using IJulia; notebook(detached=true)
[ Info: running `/usr/bin/jupyter notebook`
Process(setenv(`/usr/bin/jupyter notebook`; dir="/home/gary"), ProcessRunning)
proudindiv commented 6 months ago

Screenshot at 2024-05-01 02-03-31

proudindiv commented 6 months ago

Screenshot at 2024-05-01 02-09-57

stevengj commented 6 months ago

1.10.3 works fine for me.

Did you try running build IJulia to make sure it knows if the path to julia has changed?

Try running /usr/bin/jupyter notebook at the command line, so that you can see the whole error message in the terminal. See also https://julialang.github.io/IJulia.jl/stable/manual/troubleshooting/

proudindiv commented 6 months ago

Thanks, that gave me enough information to find out that the problem is in the jupyter kernel.json file that IJulia creates.

{
  "display_name": "julia-1.10.3 1.10.3",
  "argv": [
    "/opt/julialang/julia-1.10.3/bin/julia",
    "-i",
    "--color=yes",
    "julia-1.10.3",
    "/home/gary/.julia/packages/IJulia/Vo51o/src/kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "signal"
}

I compared the julia-1.10.3 version of the file to my julia-1.10.2 version. I manually removed the "julia-1.10.3", line in the argv to make it work. This is all behind the scenes and beyond my abilities, so I don't know if this is an issue for IJulia.jl.

proudindiv commented 5 months ago

I have the same problem and had to make the same equivalent fix in +1.10.4. I updated julia with 'juliaup' and added the new kernel after adding the new julia channel on the linux command line:

juliaup add 1.10.4
juliaup link +1.10.4 julia-1.10.4
gary@gary-NUC11BTMi9:~$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.4 (2024-06-04)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |
julia> using IJulia

julia> installkernel("julia-1.10.4","julia-1.10.4")
[ Info: Installing julia-1.10.4 kernelspec in /home/gary/.local/share/jupyter/kernels/julia-1.10.4-1.10
"/home/gary/.local/share/jupyter/kernels/julia-1.10.4-1.10"

julia> using IJulia; notebook(detached=true)
[ Info: running `/usr/bin/jupyter notebook`
Process(setenv(`/usr/bin/jupyter notebook`; dir="/home/gary"), ProcessRunning)

I haven't found any documentation on what work flow to use to add new julia versions with the new juliaup installation method and how it fits in with IJulia package. I still had to find the ~/.local/share/jupyter/kernels/julia-1.10.4-1.10/julia-1.10.4-1.10/kernel.json file and delete the "julia-1.10.4", line.

proudindiv commented 6 days ago

Okay, no response on this for over half a year. Same thing happens with julia 1.11.1, on my fourth computer.