Specifying default Conda env for Gateway containers

We run a JupyterHub deployed on Kubernetes with the DaskHub Helm chart. It uses a custom Jupyter image that contains a few different conda environments. This image is used for Dask Gateway as well via : DASK_GATEWAY__CLUSTER__OPTIONS__IMAGE: ‘{{JUPYTER_IMAGE_SPEC}}’.

I have set DASK_ROOT_CONFIG to be the location of the conda environment to use by default, but it’s not getting picked up and the workers start up with just generic (conda) as the env leading to version mismatches and module not found exceptions when trying to run actual workloads. Also updated is /.bash_profile to load /etc/bash.bashrc which has a command to activate the environment. CONDA_ENV is set, but we do not set ENV_NAME which is how I’ve activated envs in other conda containers.

I thought I had this addressed at one point and it was loading the specified conda env when the cluster was started but now it’s no longer working.

What is the correct way to tell Dask Gateway images the conda environment to use on start?

Hi @NickCote,

DASK_ROOT_CONFIG is a folder to put Dask yaml configuration file, I don’t believe it is useed for conda environment.

For Dask Gateway, there is no direct way to give a conda environment to use on start, it will just use the default interpreter of the image. I guess there are several ways you could try to do this:

  • Set appropriate environment variables in the Kubernetes yaml fil under gateway.backend.environment key.
  • Customize you Docker image to set the correct default environment, or use some startup script.
  • Try configuring the worker_cmd in the KubeClusterConfig, trough putting code in the Kubernetes yaml.