Conda Python env for JupyterLab Desktop
A quick tip on how to create a Python environment with Conda, and then use it in JupyterLab Desktop.
This guide assumes Windows operating system.
-
If you haven’t yet, install Miniconda.
-
Open Anaconda Prompt window. All commands in following steps should be run in this window.
-
Set the resolver to Mamba for faster package installation:
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
- Create Python environment:
conda create -n myenv_python11 python=3.12.11
If you are not sure which Python version you prefer to use with the new environment, refer to Status of Python versions and Python Source Releases to locate the newest release number in newest branch marked as security. During writing of this post, the latest branch marked as security was 3.11, and its newest release number was 3.11.9.
It is a good practice to list the environment’s purpose and its Python version in its name.
- Activate the newly created environment:
conda activate myenv_python11
- Install the package
jupyterlabwhich is required by JupyterLab Desktop, as well as other necessary for you Python libraries:
conda install -c conda-forge jupyterlab=4.2.5
To determine the latest JupyterLab version supported by JupyterLab Desktop, refer to the release notes for JupyterLab Desktop.
-
Go to the latest JupyterLab Desktop release on Github.
-
Under Assets, look for
JupyterLab-Setup-Windows-x64.exe. Download the file and install the application. -
Open JupyterLab Desktop.
-
On the JupyterLab Desktop welcome screen, navigate to Manage Python environments available under the hamburger icon in upper right corner.
-
In the newly opened
Manage Python environments, click onAdd existingand navigate to your environment’spython.exefile:C:\Users\{windows user}\miniconda3\envs\{environment name}\python.exe.
For the example environment name in this post, and an example Windows user called User, the path should look like following:
C:\Users\User\miniconda3\envs\myenv_python11\python.exe
-
Go back to previous JupyterLab Desktop window and open the folder where you intend to keep the Jupyter notebook files.
-
Click on the environment name in upper right corner. In the expanded list of environments under
Restart session with different Python environment, pick your Conda environment. JupyterLab Desktop will now restart automatically and apply the setting.