27

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?

Yul
  • 3,216
  • 2
  • 18
  • 13
  • You may refer the video posted here for tutorial on setting Jupterlab as a desktop application. https://www.youtube.com/watch?v=BhD1jPOOdro – Regi Mathew Oct 08 '18 at 10:24

10 Answers10

44

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.

Community
  • 1
  • 1
Gabriel
  • 541
  • 4
  • 3
  • 1
    I had to restart my machine in order for it to work well, without bugs. – Maverick Meerkat Sep 12 '19 at 10:27
  • Note: if your other anaconda shortcuts are already running automatically in a Chrome window, you might have to skip step 1 in order for it to work. (That's what worked for me) – Martijn Sep 16 '20 at 12:06
  • 1
    To just copy paste the shortcut target (without having to rewrite the username), use: `%USERPROFILE%\Anaconda3\python.exe %USERPROFILE%\Anaconda3\cwp.py %USERPROFILE%\Anaconda3 %USERPROFILE%\Anaconda3\python.exe %USERPROFILE%\Anaconda3\Scripts\jupyter-lab-script.py %USERPROFILE%` – BoZenKhaa Oct 17 '20 at 22:17
  • How would i do that for different conda environments? – sfluck Feb 12 '21 at 09:38
  • 1
    See this [link](https://github.com/jupyterlab/jupyterlab/issues/9512) for problems with **JupyterLab 3**. Basically you ave to rename the `jupyter_notebook_config.py` to `jupyter_server_config.py` – nanuuq Apr 28 '21 at 05:51
7

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 :-)

krassowski
  • 13,598
  • 4
  • 60
  • 92
Coffee and Code
  • 885
  • 14
  • 16
6

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

Gonçalo Peres
  • 11,752
  • 3
  • 54
  • 83
rashfmnb
  • 9,959
  • 4
  • 33
  • 44
6

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 on an empty field in your Windows file explorer, select New > Shortcut, and paste in the value above. After that, you can right-click on the shortcut and select 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.

DanielTuzes
  • 2,494
  • 24
  • 40
  • I tried this with a new environment in Anaconda and it didn't worked. The shortcut target is: `%windir%\System32\cmd.exe "/K" C:\Users\%username%\Anaconda3\envs\tf-keras-gpu\Scripts\activate.bat C:\Users\%username%\Anaconda3 & jupyter lab && exit` Any ideas? – Murilo Dec 02 '21 at 20:59
  • 1
    What is shown in the terminal? I think `C:\Users\%username%\Anaconda3\envs\tf-keras-gpu\Scripts\activate.bat C:\Users\%username%\Anaconda3` doesn't activate your environment: you call the activator in the new env, but pass the base (?) env as argument. I would try `%windir%\System32\cmd.exe "/K" C:\Users\%username%\Anaconda3\Scripts\activate.bat tf-keras-gpu & jupyter lab && exit` first. – DanielTuzes Dec 02 '21 at 23:10
  • That worked! Thank you! – Murilo Dec 02 '21 at 23:18
  • upvote because this works with mambaforge while "copying" how anaconda does it for jupyter notebook does not work with mambaforge. – beginner_ Jun 28 '23 at 08:43
1

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

David Filler
  • 198
  • 7
0

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

EasyPHP
  • 126
  • 6
0
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.

  • This opens a command prompts and runs several lines properly but at the end it doesn't open automatically the session on the browser, it gives you a command line to paste on the browser. Hoy can I automatize it? – skan May 17 '22 at 20:13
0

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.

Camilla
  • 111
  • 10
0

The responses by Gabriel, BoZenKhaa, rashfmnb are applicable.
More appropriate is Coffee and Code response (edited by krassowski): Jupyter Desktop as it directly address ... running JupyterLab as a Desktop Application in Windows 10.
PS: I would have preferred that JupyterLab Desktop has option for standalone zip and not just .exe

As alluded to by EasyPHP, if Anaconda is installed in a different location or moved to a different location, kindly check the (new) location and adjust.

If JupyterLab Desktop is not installed, but JupyterLab is installed (through Anaconda), one can add JupyterLab shortcut to Win10 Start Menu (works for me)

  1. Go to %appdata%\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)\ | or Press Window Start, type 'Jupyter', within Jupyter Notebook, select 'Open file Location'
  2. Inside the Start Menu folder (Programs, Anaconda3), duplicate (copy & paste) the "Jupyter Notebook (Anaconda3).lnk" shortcut.
    Alternatively, create a new shortcut. NB: You can duplicate for any environment you want.
  3. Rename the new shortcut as "JupyterLab (Anaconda3).lnk"
  4. Right click the new shortcut (JupyterLab (Anaconda3).lnk), select 'Properties', in the Target field, enter: C:\%path%\Anaconda3\python.exe C:\%path%\Anaconda3\cwp.py C:\%path%\Anaconda3 C:\%path%\Anaconda3\python.exe C:\%path%\Anaconda3\Scripts\jupyter-lab-script.py "%USERPROFILE%/" NB: substitute %path% with the path to your Anaconda.
    Default (see BoZenKhaa):
    %USERPROFILE%\Anaconda3\python.exe %USERPROFILE%\Anaconda3\cwp.py %USERPROFILE%\Anaconda3 %USERPROFILE%\Anaconda3\python.exe %USERPROFILE%\Anaconda3\Scripts\jupyter-lab-script.py %USERPROFILE%
  5. Select 'Change icon': locate the location for a copy
    A copy (icon.ico) can be downloaded from https://github.com/jupyterlab/jupyterlab-desktop/blob/master/dist-resources/icon.ico. Preferably, rename it to jupyterlab.ico. Save to &path%Anaconda3\Menu folder where the other icons are located.
  6. Apply, OK
  7. On Windows Start, type 'Jupyter', the (new) JupyterLab shortcut is listed.
  8. Select and enjoy.

JupyterLab 3.3.2

NB: Raghuveer Varahagiri's documentation is difficult to follow or unclear or lacks clarity. Missing step or jump in step 3 to step 4.

semmyk-research
  • 333
  • 1
  • 9
0

I do the same thing as Gabriel said, but for my own purpose, I need to open Jupyter Lab using Miniconda3 inside an environment on another directory rather than user directory.

To achieve that, I need to add some command and change the last part on target field, so instead of :

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

I change the "Anaconda3" into "miniconda3", and after "cwp.py", instead of

C:\Users\[username]\Anaconda3

I change it to

C:\Users\[username]\miniconda3\envs\[envname]

and the last part, "%USERPROFILE%/", I make it as my desired directory, so the final result would be looked like this:

C:\Users\[username]\miniconda3\python.exe C:\Users\[username]\miniconda3\cwp.py C:\Users\[username]\miniconda3\envs\[envname] C:\Users\[username]\miniconda3\envs\[envname]\python.exe C:\Users\[username]\miniconda3\envs\[envname]\Scripts\jupyter-lab-script.py [path_to_my_dir]

for my case, my username is John, my envname is jupyter_env, and my directory to open the jupyter lab is D:\Python Project, the final result would be like this:

C:\Users\John\miniconda3\python.exe C:\Users\John\miniconda3\cwp.py C:\Users\John\miniconda3\envs\jupyter_env C:\Users\John\miniconda3\envs\jupyter_env\python.exe C:\Users\John\miniconda3\envs\jupyter_env\Scripts\jupyter-lab-script.py D:\Python Project