In order to start using JupyterLab you need to have python install on you machine. In order to avoid breaking existing python installations in terms of dependencies. You should always create a seperate python environment wich will serve as the environment hosting JupyterLab.
It is possible to create python environments using tools such as virtualenv or the build in module venv. However we will use conda to create an python environment. Conda is also a package management tool like pip, but with better dependency solving during package installation.
Install Miniconda and use the conda cli to create a new python environment.
The create command can look like this.
conda create --name MyEnvName python=3.7 -c conda-forge
Activate the conda environment.
conda activate MyEnvName
When the python environment is active every subsequent package that is installed using the conda install
command will only be install in the active environment, thus keeping all other Python installations clean.
You can read more about conda environments here if you want to learn more about conda and how to set up a data science environment.
JupyterLab installation
In order to install jupyter lab you can use the following conda command.
conda install -c conda-forge jupyterlab
After installation JupyterLab can be activated by running the following command from the activated python environment. Before running Jupyter lab it is a good idea to cd
into the folder which will be your working directory.
jupyter lab
JupyterLab should now be running on http://localhost:8888/lab.
Start a new notebook by clicking on one of the environments below Notebook. In order to add your conda environment as an option, you need to add it as an Kernal. Executing the following command from your activated conda environment.
python -m ipykernel install --user --name=MyKernalName
Now your python environment should be one of the options to start a notebook from.
Click on your environment to start a new notebook on JupyterLab.
That’s it, now you have a created your own python conda environment, installed JupyterLab, added your python environment as a Kernal to Jupyter Lab and started a notebook using your Kernal inside Jupyter Lab.
0 Comments
1 Pingback