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
.
Cloning the current environment
Get the name of the current development environment from
conf\env\conda_env_win32.yaml
.name: 2021-04-red-fox channels: - defaults - foxbms dependencies: - 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
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
Activate the new development environment:
(base) C:\Users\vulpes>conda activate NEW_ENV_NAME
Optional: Update all conda packages:
(NEW_ENV_NAME) C:\Users\vulpes>conda update --all
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
Install/Update/Remove the packages accordingly to your needs using
conda
orpip
:(NEW_ENV_NAME) C:\Users\vulpes>conda install my_package (NEW_ENV_NAME) C:\Users\vulpes>pip install my_other_package
Export the new development environment:
(NEW_ENV_NAME) C:\Users\vulpes>conda env export > path\to\conf\env\conda_env_win32.yaml
Remove the
Prefix
entry fromconf\env\conda_env_win32.yaml
.Commit the new environment to the repository.
8.2.7.1. Further Reading¶
An explanation why build environments are used is found in Build Environment.