8.2.7. Changing and Extending the Build Environment

If packages are needed that are not included in development environment they can simply be added. This how-to explains it for Windows. If there is a reference to conf\env\conda_env_win32.yaml and you are on Linux replace it by conf/env/conda_env_linux.yaml.

  1. Cloning the current environment

    1. Get the name of the current development environment from conf\env\conda_env_win32.yaml.

      Listing 8.38 Shortened snippet from conf\env\conda_env_win32.yaml that shows the development environment name.
      name: 2021-04-red-fox
        - defaults
        - foxbms
        - alabaster=0.7.12=pyhd3eb1b0_0
        - argon2-cffi=20.1.0=py38he774522_1
        - requests=2.25.1=pyhd3eb1b0_0
        - ruamel_yaml=0.15.87=py38he774522_1
        - scikit-learn=0.23.2=py38h47e9c7a_0
        - scipy=1.5.2=py38h14eb087_0
        - send2trash=1.5.0=pyhd3eb1b0_1
        - setuptools=52.0.0=py38haa95532_0
    2. Clone the current development environment by activating the base environment and using the following command:

      C:\Users\vulpes>%USERPROFILE%\miniconda3\Scripts\activate base
      (base) C:\Users\vulpes>conda create --name NEW_ENV_NAME --clone CURRENT_ENV_NAME
  2. Activate the new development environment:

    (base) C:\Users\vulpes>conda activate NEW_ENV_NAME
  3. Optional: Update all conda packages:

    (NEW_ENV_NAME) C:\Users\vulpes>conda update --all
  4. Optional: Update pip packages. It is not recommended to bulk update all pip packages. It is best to get a list of all pip dependencies

    (NEW_ENV_NAME) C:\Users\vulpes>conda list | findstr /I "pypi"
    markdown                  2.6.11                   pypi_0    pypi

    and then update these one by one and check for errors and role back in case of errors:

    (NEW_ENV_NAME) C:\Users\vulpes>pip install markdown --upgrade
  5. Install/Update/Remove the packages accordingly to your needs using conda or pip:

    (NEW_ENV_NAME) C:\Users\vulpes>conda install my_package
    (NEW_ENV_NAME) C:\Users\vulpes>pip install my_other_package
  6. Export the new development environment:

    (NEW_ENV_NAME) C:\Users\vulpes>conda env export > path\to\conf\env\conda_env_win32.yaml
  7. Remove the Prefix entry from conf\env\conda_env_win32.yaml.

  8. Commit the new environment to the repository. Further Reading

An explanation why build environments are used is found in Build Environment.