# Jupyterlab() only works after I run Pkg.build("IJulia") every time

**URL:** <https://discourse.julialang.org/t/jupyterlab-only-works-after-i-run-pkg-build-ijulia-every-time/79507>\
**Category:** Jupyter-Notebook\
**Created:** [April 14, 2022, 8:23pm UTC](https://discourse.julialang.org/t/jupyterlab-only-works-after-i-run-pkg-build-ijulia-every-time/79507 "2022-04-14T20:23:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gnicolosi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnicolosi/32/48031_2.png) [@gnicolosi](https://discourse.julialang.org/u/gnicolosi)\
**Post date:** [April 14, 2022, 8:23pm UTC](https://discourse.julialang.org/t/jupyterlab-only-works-after-i-run-pkg-build-ijulia-every-time/79507/1 "2022-04-14T20:23:06Z")

</div>

Hi, all of a sudden I am only able to make jupyterlab work properly by running the following before the jupyterlab() call:

```julia
using Pkg
Pkg.build("IJulia")

```

If I don’t do so, jupyterlab open on the browser and gives me a “failed to connect” message. Below is what I see:

```julia
julia> using IJulia

julia> jupyterlab()
[Info: running setenv(`'C:\Users\Gabriel\.julia\conda\3\Scripts\jupyter.exe' lab`,["PATH=C:\\Users\\Gabriel\\.julia\\conda\\3\\Library\\bin;C:\\Users\\Gabriel\\.julia\\conda\\3\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Users\\Gabriel\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\Gabriel\\AppData\\Local\\Programs\\Julia-1.7.2\\bin", "USERDOMAIN_ROAMINGPROFILE=DESKTOP-FTPN55F", "HOMEPATH=\\Users\\Gabriel", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC", "SESSIONNAME=Console", "SYSTEMROOT=C:\\Windows", "APPDATA=C:\\Users\\Gabriel\\AppData\\Roaming", "PSMODULEPATH=C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules", "COMMONPROGRAMW6432=C:\\Program Files\\Common Files", "PROGRAMDATA=C:\\ProgramData", "PUBLIC=C:\\Users\\Public", "USERDOMAIN=DESKTOP-FTPN55F", "OS=Windows_NT", "PROCESSOR_REVISION=9702", "TMP=C:\\Users\\Gabriel\\AppData\\Local\\Temp", "COMSPEC=C:\\Windows\\system32\\cmd.exe", "ALLUSERSPROFILE=C:\\ProgramData", "COMPUTERNAME=DESKTOP-FTPN55F", "USERNAME=Gabriel", "CONDARC=C:\\Users\\Gabriel\\.julia\\conda\\3\\condarc-julia.yml", "USERPROFILE=C:\\Users\\Gabriel", "PROCESSOR_LEVEL=6", "PROGRAMW6432=C:\\Program Files", "TEMP=C:\\Users\\Gabriel\\AppData\\Local\\Temp", "HOMEDRIVE=C:", "PYTHONIOENCODING=UTF-8", "WINDIR=C:\\Windows", "ZES_ENABLE_SYSMAN=1", "LOCALAPPDATA=C:\\Users\\Gabriel\\AppData\\Local", "PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 151 Stepping 2, GenuineIntel", "NUMBER_OF_PROCESSORS=24", "=::=::\\", "COMMONPROGRAMFILES(X86)=C:\\Program Files (x86)\\Common Files", "VBOX_MSI_INSTALL_PATH=C:\\Program Files\\Oracle\\VirtualBox\\", "COMMONPROGRAMFILES=C:\\Program Files\\Common Files", "ONEDRIVE=C:\\Users\\Gabriel\\OneDrive", "PROGRAMFILES(X86)=C:\\Program Files (x86)", "OPENBLAS_NUM_THREADS=8", "PROGRAMFILES=C:\\Program Files", "LOGONSERVER=\\\\DESKTOP-FTPN55F", "DRIVERDATA=C:\\Windows\\System32\\Drivers\\DriverData", "CONDA_PREFIX=C:\\Users\\Gabriel\\.julia\\conda\\3", "FPS_BROWSER_USER_PROFILE_STRING=Default", "SYSTEMDRIVE=C:", "FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer", "PROCESSOR_ARCHITECTURE=AMD64", "OPENBLAS_MAIN_FREE=1"])
Process(setenv(`'C:\Users\Gabriel\.julia\conda\3\Scripts\jupyter.exe' lab`,["PATH=C:\\Users\\Gabriel\\.julia\\conda\\3\\Library\\bin;C:\\Users\\Gabriel\\.julia\\conda\\3\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Users\\Gabriel\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\Gabriel\\AppData\\Local\\Programs\\Julia-1.7.2\\bin", "USERDOMAIN_ROAMINGPROFILE=DESKTOP-FTPN55F", "HOMEPATH=\\Users\\Gabriel", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC", "SESSIONNAME=Console", "SYSTEMROOT=C:\\Windows", "APPDATA=C:\\Users\\Gabriel\\AppData\\Roaming", "PSMODULEPATH=C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules", "COMMONPROGRAMW6432=C:\\Program Files\\Common Files", "PROGRAMDATA=C:\\ProgramData" … "OPENBLAS_NUM_THREADS=8", "PROGRAMFILES=C:\\Program Files", "LOGONSERVER=\\\\DESKTOP-FTPN55F", "DRIVERDATA=C:\\Windows\\System32\\Drivers\\DriverData", "CONDA_PREFIX=C:\\Users\\Gabriel\\.julia\\conda\\3", "FPS_BROWSER_USER_PROFILE_STRING=Default", "SYSTEMDRIVE=C:", "FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer", "PROCESSOR_ARCHITECTURE=AMD64", "OPENBLAS_MAIN_FREE=1"]; dir="C:\\Users\\Gabriel"), ProcessExited(1))

julia>

```

As you can see, the prompt returns to `julia>` and on the browser I see:

![Capture](https://global.discourse-cdn.com/julialang/original/3X/7/8/783137960d97ec277f6a6e22e68f6697de9f5a08.png)

If I click on “Dismiss” and try to connect manually by selecting a Kernel on the Jupyterlab page (right upper corner), I get the following:

![Capture](https://global.discourse-cdn.com/julialang/original/3X/c/0/c0b01a3e343d4a37caf70226e3580285cd860c9b.png)

I feel that there’s something wrong with this behavior. I don’t think I need to build IJulia every time to make it work. Interestingly, this behavior is not present when opening a simple notebook. When opening `notebook()` the notebook properly connects with the Kernel right off the bat.

I could not find any similar issues online besides the remedy solution of building IJulia.

If anyone is able to help me figure out what might be going on, I would be very thankful.

Thank you,

Gabriel

---

<div class="post-metadata">

**Author:** ![maxkapur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxkapur/32/21208_2.png) [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Post date:** [April 15, 2022, 4:29am UTC](https://discourse.julialang.org/t/jupyterlab-only-works-after-i-run-pkg-build-ijulia-every-time/79507/2 "2022-04-15T04:29:33Z")

</div>

Does the same problem happen if you run `jupyter lab` from the command line (outside of Julia)?

---

<div class="post-metadata">

**Author:** ![gnicolosi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnicolosi/32/48031_2.png) [@gnicolosi](https://discourse.julialang.org/u/gnicolosi)\
**Post date:** [April 15, 2022, 10:11pm UTC](https://discourse.julialang.org/t/jupyterlab-only-works-after-i-run-pkg-build-ijulia-every-time/79507/3 "2022-04-15T22:11:10Z")

</div>

I did open the `cmd` in windows and typed `jupyter notebook` and got a message saying that this is not recognized as an internal or external command. I am not experienced with the command line to ensure what I am doing is correct. I noticed also that after the server cannot connect, going back to the REPL and entering `jupyterlab()` does make jupyter lab work, but this is weird because the first call to open always fails.  
Thanks for helping, let me know if there’s something else I can try.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 16, 2022, 1:27am UTC](https://discourse.julialang.org/t/jupyterlab-only-works-after-i-run-pkg-build-ijulia-every-time/79507/4 "2022-04-16T01:27:49Z")

</div>

Building IJulia should only be necessary if the location of the `julia.exe` executable changes.

Is it possible that you are running Julia from some kind of temporary filesystem that changes each time? What is `Sys.BINDIR` (the location of `julia.exe`)?

---

<div class="post-metadata">

**Author:** ![gnicolosi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnicolosi/32/48031_2.png) [@gnicolosi](https://discourse.julialang.org/u/gnicolosi)\
**Post date:** [April 19, 2022, 6:08pm UTC](https://discourse.julialang.org/t/jupyterlab-only-works-after-i-run-pkg-build-ijulia-every-time/79507/5 "2022-04-19T18:08:49Z")

</div>

I have figured out what the problem was. Thank you for all the replies. I have a Virtual Machine running Linux Mint and had a kernel running there in Jupyterlab as well (even though the VM was powered off, which is weird). Once shutting down those Kernels, Jupyterlab behaves normally in Windows. This is a very specific issue, but other people might run into the same thing in the future.
