Install Anaconda if it is not already available on your system (I recommend the lightweight Miniconda). On Arch Linux, it can be installed from the AUR:

yay -Syu miniconda3

To set up an Anaconda virtual environment with the required tools (QGIS, Python, or R), save the snippet under the relevant section as a YAML file (e.g. environment.yml). Then, run the following commands, replacing ${envname} with the name of the environment as defined in the first line of the YAML file:

conda env create --file environment.yml
conda activate ${envname}

Note
All of these packages can be installed in a single Anaconda virtual environment via the conda-forge channel (though I haven’t checked to see if there are potential conflicts).

QGIS

name: qgis
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3
  - qgis

Python

name: py-geo
channels:
  - conda-forge
  - anaconda
dependencies:
  - python=3
  - geopandas
  - rioxarray
  - rasterstats
  - scipy
  - cfgrib
  - netcdf4
  - cdo  # unavailable on Windows; use Conda with WSL
  - dask  # parallel computing
  - pooch  # to download data
  - matplotlib  # plotting tools
  - matplotlib_scalebar
  - nc-time-axis
  - seaborn
  - cartopy
  - mapclassify
  - contextily
  - pyviz
  - hvplot
  - statsmodels
  - jupyterlab  # interactive notebooks
  - jupyter_bokeh
  - pytest  # testing and linting
  - flake8
  - pylint
  - black
  - black-jupyter

R

See this post for more information about setting up R to use with JupyterLab in an Anaconda environment.

name: r-geo
channels:
  - conda-forge
  - r
  - anaconda
dependencies:
  - r-base
  - r-essentials
  - libgit2  # to install packages from Git repositories
  - r-devtools
  - r-terra
  - r-rgdal
  - r-sf
  - r-geojsonio
  - r-rgeos
  - r-rastervis
  - jupyterlab