My Digital Garden

Install Miniconda on WSL2

Install Miniconda on WSL2

This recipe sets up a core Data Science environment in WSL2 using Miniconda as the base.


  1. We assume that you have a working WSL2 distribution

  2. Install Miniconda

    cd ~
    chmod +x
  3. Update packages

    conda update conda
    conda update --all
  4. Create an environment with the version of python you want and necessary packages

    conda env create --name datasci --python=3.11
    conda activate datasci
    conda install pandas scikit-learn matplotlib jupyter jupyterlab sqlalchemy seaborn pip git ipykernel notebook
    conda install -c conda-forge jupyter_contrib_nbextensions
    conda update conda
    conda update --all
  5. go to your working directory and export an environment.yml

    cd myproject
    conda env export > environment.yml
  6. Setup a virtual Python kernel in the environment

    python -m ipykernel install --user --name=datasci

    To use that kernel, see Setting up virtual python kernel in environment

See also