# Julia kernel doesn't connect when using jupyter

**URL:** https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052
**Category:** New to Julia
**Tags:** jupyter
**Created:** [August 20, 2022, 4:32am UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052 "2022-08-20T04:32:15Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![aaportel](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aaportel](https://discourse.julialang.org/u/aaportel)
#### Post date: [August 20, 2022, 4:32am UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/1 "2022-08-20T04:32:15Z")

</div>

Hi all,

I’m doing my darndest to try and use Julia with jupyter as ssh’ing through an iPad is all I have access to. I have finally been able to install Julia and IJulia without precompile errors on the host computer in spite of Julia’s best efforts. But now, when I try to run anything in a notebook, the julia kernel never connects. This is in Julia 1.7.3

This is my install procedure:

- conda create -n jul
- conda activate jul
- conda install jupyterlab julia

then in julia:

- ]add IJulia

I’ve experimented with Pluto, which I can get working and has the ability to port forward, but I can’t run the Julia tutorials on it so that’s a nonstarter. I would appreciate any help anyone can give.

Edit:  
Just tried another thing.  
In a fresh environment,

```julia
$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.0-linux-x86_64.tar.gz
$ tar -xf julia-1.8.0-linux-x86_64.tar.gz
$ julia-1.8.0/bin/julia
julia> using Pkg
julia> Pkg.add("IJulia")
julia> using IJulia
julia> notebook(detached=true)
julia> run(`$(IJulia.find_jupyter_subcommand("")[1]) notebook list`)

```

that last line would return a link with a token for me to paste into my browser. All the steps above run fine. I’m even able to start jupyter and get into it. But as soon as I try to open a notebook and connect to a kernel, the kernel fails to connect and gives me an error describing as such, same error I’ve received every time.

---

<div class="post-metadata">

### Author: ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)
#### Post date: [August 20, 2022, 6:54am UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/2 "2022-08-20T06:54:24Z")

</div>

Is there any reason not to let IJulia have a private Python+Jupyter installation as described in the [manual](https://julialang.github.io/IJulia.jl/stable/manual/running/)?

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [August 20, 2022, 9:42am UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/3 "2022-08-20T09:42:12Z")

</div>

If conda is not working, try using [`juliaup`](https://github.com/JuliaLang/juliaup) to install Julia. Installing julia via conda is not officially supported.

If you insist on using conda, try this:

```julia
conda create -n juliaup -c conda-forge juliaup
conda activate juliaup
julialauncher

```

or just download Julia from [Download Julia](https://julialang.org/downloads/) .

The conda-forge version is nice when it works and you have other packages you want to work with in the environment, but if it’s giving you trouble my first recommendation is to see if directly downloading julia from [julialang.org](http://julialang.org) will work.

If you can find any logs, output, or anything else giving an error, please share that with us here.

---

<div class="post-metadata">

### Author: ![aaportel](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aaportel](https://discourse.julialang.org/u/aaportel)
#### Post date: [August 20, 2022, 2:51pm UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/4 "2022-08-20T14:51:36Z")

</div>

Yes, this is also one of the installation procedures I’ve tried with the same results.

---

<div class="post-metadata">

### Author: ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)
#### Post date: [August 20, 2022, 3:10pm UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/5 "2022-08-20T15:10:29Z")

</div>

> [@aaportel](#):
>
> the julia kernel never connects

Does it fail explicitly, or does it just keep trying? Is there any output at the console you’re running the Jupyter command from?

If you’ve not tried it already, try a `]build IJulia` and see if that reports any errors. Also, I’ve found that installing IJulia in anything other than the base environment `@v1.7` can cause issues, so make sure you have it in that environment.

Running `jupyter-kernelspec list` should give you a list of kernel names and directories. In the directory corresponding to the Julia entry, there will be a `kernel.json` file. Please paste the contents of that file here.

---

<div class="post-metadata">

### Author: ![aaportel](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aaportel](https://discourse.julialang.org/u/aaportel)
#### Post date: [August 20, 2022, 3:26pm UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/6 "2022-08-20T15:26:30Z")

</div>

> ```julia
> conda create -n juliaup -c conda-forge juliaup
> conda activate juliaup
> julialauncher
> 
> ```

This ended up doing the trick. After so many weeks of trying, thank you for your help!

---

<div class="post-metadata">

### Author: ![aaportel](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aaportel](https://discourse.julialang.org/u/aaportel)
#### Post date: [August 20, 2022, 4:45pm UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/7 "2022-08-20T16:45:12Z")

</div>

Turns out this didn’t fix the problem. It worked once and now it won’t work anymore. I have no idea how something like that can happen.

---

<div class="post-metadata">

### Author: ![aaportel](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aaportel](https://discourse.julialang.org/u/aaportel)
#### Post date: [August 20, 2022, 4:57pm UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/8 "2022-08-20T16:57:35Z")

</div>

It fails explicitly. Both Conda and IJulia build without any errors.

This is the output of jupyter-kernelspec list:

```julia
Available kernels:
  julia-1.8 /home/aaportel/.local/share/jupyter/kernels/julia-1.8
  python3 /home/aaportel/.julia/conda/3/share/jupyter/kernels/python3

```

and here is the contents of the kernel file:

```julia
~$ cat /home/aaportel/.local/share/jupyter/kernels/julia-1.8/kernel.json 
{
  "display_name": "Julia 1.8.0",
  "argv": [
    "/home/aaportel/julia-1.8.0/bin/julia",
    "-i",
    "--color=yes",
    "--project=@.",
    "/home/aaportel/.julia/packages/IJulia/AQu2H/src/kernel.jl",
    "{connection_file}"
  ],
  "language": "julia",
  "env": {},
  "interrupt_mode": "signal"
}

```

The errors I get when the kernel fails are something like:

```julia
ERROR: LoadError: Failed to precompile IJulia
ERROR: LoadError: Failed to precompile Conda

```

So far I’ve tried Julia 1.6, 1.7 and 1.8. I’ve tried within a conda environment, and by downloading Julia on its own, tried installing jupyter internally through `Conda.add` as well as independently with conda in the same conda environment, I’ve tried setting `ENV["JUPYTER"]`to the path of jupyter in that environment. I’ve tried multiple host computers, all running some version of x86 linux. I’ve reinstalled conda multiple times and cleaned all my environments, I’ve reinstalled Julia, cleaning .cache, .julia, .local, etc. I’m becoming increasingly frustrated by how difficult it has been to get into this language.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [August 20, 2022, 7:02pm UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/9 "2022-08-20T19:02:42Z")

</div>

We need a full stack trace to understand what is happening. It’s likely that your conda Python configuration is interfering with the Python environment that Julia setup for itself.

Use `conda deactivate` until you have a normal prompt without “(base)” or any other environment in the prefix.

Also considering moving or removing your current `~/.julia` to start fresh.

Then do the following. Notice we are not explicitly installing Jupyter since installing IJulia.jl does that for us.

```julia
ENV["PYTHON"] = ""
using Pkg
pkg"add PyCall"
pkg"build PyCall"
pkg"add IJulia"
pkg"build IJulia"

```

Running `julia /home/aaportel/.julia/packages/IJulia/AQu2H/src/kernel.jl` may give some initial hints. Please copy the entire output to here. We can hopefully figure iut what is preventing IJulia from precompiling.

What we are trying to do is to let julia setup it’s own conda environment within `~/.julia/conda` This way when you install IJulia it will install exactly the Python packages it needs to function, no more and no less.

My recommedation is to use Julia 1.7 at the moment, simply because we just released 1.8. 1.8 should work but we are just starting to widely deploy it.

---

<div class="post-metadata">

### Author: ![aaportel](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@aaportel](https://discourse.julialang.org/u/aaportel)
#### Post date: [August 20, 2022, 8:37pm UTC](https://discourse.julialang.org/t/julia-kernel-doesnt-connect-when-using-jupyter/86052/10 "2022-08-20T20:37:46Z")

</div>

Alright. I finally got it to consistently work by downloading 1.7.3 directly from the website, hosting on a different computer, making sure to remove .julia, making sure not to be in any conda environment.  
My exact commands are:

```julia
$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.3-linux-x86_64.tar.gz
$ tar -xf julia-1.7.3-linux-x86_64.tar.gz
$ julia-1.7.3/bin/julia
julia> ENV["PYTHON"] = ""
julia> using Pkg
julia> pkg"add PyCall"
julia> pkg"build PyCall"
julia> pkg"add IJulia"
julia> pkg"build IJulia"
julia> using IJulia
julia> jupyterlab(detached=true)
julia> run(`$(IJulia.find_jupyter_subcommand("")[1]) lab list`)

```

and pasting the url returned by that last line.

I should note that none of this worked on 1.8, regardless of whether I was in a conda environment or not. Now on to the next roadblock…
