'Running JupyterLab as a Desktop Application in Windows 10

Cristopher Roach wrote the blog of "Running Jupyter Lab as a Desktop Application" for Mac users. It did not work for Anaconda users in Windows 10. Eventually, what I did is the below:

  1. Go to the directory of C:\ProgramData\Anaconda3\Scripts
  2. Find the file of jupyter-lab.exe and make the link of the file in Taskbars. Note: With some reasons, the message of the "Widows could not create the shortcut. Check to see if the disk is full" popped up when I tried to make the link on the Desktop.
  3. Right click on the link of jupyter-lab.exe and go to Properties.
  4. Download the icon file of Jupyterlab and save it as Jupyterlab.ico in the folder of C:\ProgramData\Anaconda3\Menu\Jupyterlab.ico (=`%ALLUSERSPROFILE%\Anaconda3\Menu\Jupyterlab.ico )
  5. Click Change Icon and copy %ALLUSERSPROFILE%\Anaconda3\Menu\Jupyterlab.ico in "Look for icons in this file".
  6. Done!

Many steps were required to go through. Is there any simpler way?



Solution 1:[1]

1. Set Jupyter Lab to run as a Chrome App

Run Anaconda Prompt from your Start menu and type:

jupyter lab --generate-config

Use your favorite text editor to open the Jupyter config file found on this location:

C:\Users\<User>\.jupyter\jupyter_notebook_config.py

Add this line to the end of the config file:

c.NotebookApp.browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe --app=%s"

2. Create a shortcut to run Jupyter Lab

Navigate to

"C:\Users\Serendipity\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)"

Make a copy of the Jupyter Notebook shortcut and name it Jupyter Lab
Right click the newly created Jupyter Lab shortcut and go to Properties, change the icon to your downloaded icon, change the comment field to say "Jupyter Lab". On the Target field, where it says jupyter-notebook-script.py, change it to jupyter-lab-script.py.

The Target field should look like this:

C:\Users\Serendipity\Anaconda3\python.exe C:\Users\Serendipity\Anaconda3\cwp.py C:\Users\Serendipity\Anaconda3 C:\Users\Serendipity\Anaconda3\python.exe C:\Users\Serendipity\Anaconda3\Scripts\jupyter-lab-script.py %USERPROFILE%

Run the shortcut, it should spawn a command prompt running the server instance, and the Jupyter Lab Chrome App window.


Creating a shortcut to access an already locally running server:

You can create a shortcut to connect to a local server with Right Click->New>Shortcut and using this as location target:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=http://localhost:8888/

You can also start a server without spawning the Chrome App window by typing jupyter lab --no-browser into the Anaconda Prompt console.

Solution 2:[2]

First write this command it will ask to overwrite please say yes:

Jupyter lab --generate-config

Then open this notebook_config.py file from this location

C:\Users\username\.jupyter\jupyter_notebook_config.py

Paste this line at the end of the file and save it. Note that you might want/have to change the location depending on the .exe (here I will be using the browser Chrome)

c.NotebookApp.browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe --app=%s"

Run the jupyter lab from the command line

jupyter lab

For more info follow this link

Solution 3:[3]

Well, there's now a desktop version:

JupyterLab Desktop

I've been using it for a couple of weeks. So far, no issues, pretty much the same.

I did have to add this in one of the top cells:

%config Configure.use_jedi=False

So, I guess it's authentic :-)

Solution 4:[4]

Use shortcut

Create a shortcut with a target:

%windir%\System32\cmd.exe "/K" C:\Users\%username%\Miniconda3\Scripts\activate.bat jupyter_env & jupyter lab && exit

where I supposed you have jupyter-lab installed in the conda environment called jupyter_env. (I don't have it in base.) To create a shortcut, right-click in an empty field in your Windows file explorer, New > Shortcut, and paste in the value above. After that, you can right-click on the shortcut and Properties.

Customize the icon

You can:

  • customize the shortcut's Start in value to %USERPROFILE% or to any specific folder.
  • assign a jupyter icon, I have one in e.g. %USERPROFILE%\miniconda3\envs\jupyter\Menu\jupyter.ico
  • copy the icon to the start menu, %AppData%\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit), if you have Windows 10
  • Pin it to the taskbar once you run jupyterlab using the shortcut. Right-click on the jupyterlab's taskbar icon while it is running and select Pin to taskbar

The original idea is from medium.

Solution 5:[5]

For Windows 10/11 use a PowerShell script file. Create a file named JupyterLab.ps1 (or any name you wish) and add two lines. The first line (which can be omitted) will change the working folder. The second line starts Jupyter Lab.

C:\Users\myusername\Documents\Programs jupyter lab

Right click on the desktop and create an empty shortcut. In the Targe box you have to include the following line to modify the execution policy or the shortcut will just open the Windows PowerShell editor instead of executing the script.

Target: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\Users\myusername\Documents\Programs\JupyterLab.ps1.

Start In: \your working directory

Solution 6:[6]

Much easier. One step only with Codekodo Jupyter (www.codekodo.net). Download, setup and run Jupyter from the systray. That's it.

Solution 7:[7]

Consolidating from the previous answers:

My Miniconda lives in C:\Users\myprofile\miniconda3. Please change the paths below as necessary.

Step 1: Create a Hidden Jupyter Lab instance shortcut

Right click on desktop and create a New > Shortcut. Paste the below code:
This runs the Jupyterlab off a hidden command prompt so that it doesn't disturb your minimal setup :)

%USERPROFILE%\miniconda3\pythonw.exe %USERPROFILE%\miniconda3\cwp.py %USERPROFILE%\miniconda3 %USERPROFILE%\miniconda3\pythonw.exe %USERPROFILE%\miniconda3\Scripts\jupyter-lab-script.py %USERPROFILE%

Tip: Change shortcut icon source to:
%USERPROFILE%\miniconda3\Lib\site-packages\notebook\static\base\images\favicon.ico

Step 2: Make JupyterLab start in its own window:

Refer to @Gabriel's answer:

  1. Run this in the conda prompt: jupyter lab --generate-config

  2. Edit this file (any text editor): C:\Users\myprofile\.jupyter\jupyter_notebook_config.py

  3. Paste the below code in the end of the file

    c.NotebookApp.browser = "C:/Program Files/Google/Chrome/Application/chrome.exe --app=%s"

Step 3: Enjoy your minimal separate Jupyter Lab instance.

Solution 8:[8]

You can create a batch file's shortcut, if you have issues configuring jupyter lab with miniconda/ or also Windows 7 issue. Open Notepad and paste:

cd /d c:\ 
call C:\Users\%USERNAME%\AppData\Local\Continuum\miniconda\Scripts\activate.bat your_virtual_env_name
jupyter lab
pause

Save this notepad as jupyter_lab.bat. Create a shortcut for this batch file and change your icon to juoyter lab icon.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 Gonçalo Peres
Solution 3 krassowski
Solution 4 DanielTuzes
Solution 5 ouflak
Solution 6 EasyPHP
Solution 7 do2blehelix
Solution 8