Conda Quickstart
Quick tutorial for setting up conda environments from jupyterhub in CloudSense.
About
In this guide you will learn how to set up a conda environment in CloudSense which will enable you to start modeling using jupyterhub, scikit-learn, tensorflow and MLflow.
Prerequisites
Procedure
Here you will install Miniconda and create an environment containing common data science packages such as pandas, numpy, matplotlib, scikit-learn and tensorflow.
Install Miniconda
Navigate to workspace > apps > deployed apps and click on the jupyterhub app URL to open jupyterhub.
Open a terminal in jupyterhub.

Enter the following to download and install Miniconda 4.12.0. Near the end of the installation you will be prompted to initialize the conda environment for bash. Enter no and proceed with the next step.
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
Set your paths, initialize conda for bash environment and update the bash environment.
export PATH="/home/jovyan/miniconda3/bin:$PATH"
conda init bash
source ~/.bashrc
Create Conda Environment
In the same terminal session, enter the following commands to create and activate an environment with python 3.9.
conda create -n env_name python==3.9
conda activate env_name
Install the latest common data science packages
conda install scikit-learn pandas numpy matplotlib ipykernel ipython_genutils boto3 requests
pip install tensorflow mlflow ipywidgets
Add conda environment to jupyterhub kernel list
ipython kernel install --user --name=env_name
Install and Configure Jupyter Widgets
To install jupyter widgets, the widget package should be installed in the conda environment as well as the global environment. The installation in the conda environment was completed in the previous step so here we will install in the global environment.
First, we need to enable the extension manager, by navigating to the extension manager > warning and clicking 'enable'. Then install the jupyter-widgets extension by searching for @jupyter-widgets/jupyterlab-manager and click install.
Once installed, open a new terminal and run the following command to install ipywidgets to the global environment.
pip install ipywidgets
Restart you jupyterhub application by closing the window and opening a new jupyterhub window.
Validation
To validate the installation of your packages, run the following command in your conda environment. After executing you'll receive a list of all the packages installed in your conda environment.
conda list
Last updated