Skip to content

Latest commit

 

History

History
255 lines (193 loc) · 10.5 KB

conda-environment-v1.md

File metadata and controls

255 lines (193 loc) · 10.5 KB
title description ms.date monikerRange
CondaEnvironment@1 - Conda environment v1 task
This task is deprecated. Use `conda` directly in script to work with Anaconda environments.
06/11/2024
>=azure-pipelines-2019

CondaEnvironment@1 - Conda environment v1 task

:::moniker range="=azure-pipelines"

Use this task to create and activate a Conda environment.

Important

[!INCLUDE task-deprecation] Use conda commands directly in the bash task or batch script task as an alternative.

:::moniker-end

:::moniker range=">=azure-pipelines-2019.1 <=azure-pipelines-2022.2"

Use this task to create and activate a Conda environment.

Important

This task has been deprecated. Use conda commands directly in the bash task or batch script task as an alternative.

:::moniker-end

:::moniker range="=azure-pipelines-2019"

Create and activate a Conda environment.

:::moniker-end

Syntax

:::moniker range=">=azure-pipelines-2019.1"

# Conda environment v1
# This task is deprecated. Use `conda` directly in script to work with Anaconda environments.
- task: CondaEnvironment@1
  inputs:
    #createCustomEnvironment: false # boolean. Create a custom environment. Default: false.
    #environmentName: # string. Required when createCustomEnvironment == true. Environment name. 
    #packageSpecs: 'python=3' # string. Package specs. Default: python=3.
    #updateConda: true # boolean. Update to the latest Conda. Default: true.
    #installOptions: # string. Optional. Use when createCustomEnvironment == false. Other options for `conda install`. 
    #createOptions: # string. Optional. Use when createCustomEnvironment == true. Other options for `conda create`. 
    #cleanEnvironment: false # boolean. Optional. Use when createCustomEnvironment == true. Clean the environment. Default: false.

:::moniker-end

:::moniker range="=azure-pipelines-2019"

# Conda Environment v1
# Create and activate a Conda environment.
- task: CondaEnvironment@1
  inputs:
    #createCustomEnvironment: false # boolean. Create a custom environment. Default: false.
    #environmentName: # string. Required when createCustomEnvironment == true. Environment name. 
    #packageSpecs: 'python=3' # string. Package specs. Default: python=3.
    #updateConda: true # boolean. Update to the latest Conda. Default: true.
    #installOptions: # string. Optional. Use when createCustomEnvironment == false. Other options for `conda install`. 
    #createOptions: # string. Optional. Use when createCustomEnvironment == true. Other options for `conda create`. 
    #cleanEnvironment: false # boolean. Optional. Use when createCustomEnvironment == true. Clean the environment. Default: false.

:::moniker-end

Inputs

:::moniker range=">=azure-pipelines-2019"

createCustomEnvironment - Create a custom environment
boolean. Default value: false.

If the value for this boolean is set to true, the task creates or reactivates a Conda environment instead of using the base environment. Setting the value to true is recommended for self-hosted agents.


:::moniker-end

:::moniker range=">=azure-pipelines-2019"

environmentName - Environment name
string. Required when createCustomEnvironment == true.

The name of the Conda environment to create and activate, or reactivate if it already exists.


:::moniker-end

:::moniker range=">=azure-pipelines-2019"

packageSpecs - Package specs
string. Default value: python=3.

The space-delimited list of packages to install in the environment.


:::moniker-end

:::moniker range=">=azure-pipelines-2019"

updateConda - Update to the latest Conda
boolean. Default value: true.

Updates Conda to the latest version. This applies to the Conda installation found in PATH or to the path specified by the CONDA environment variable.


:::moniker-end

:::moniker range=">=azure-pipelines-2019"

installOptions - Other options for conda install
string. Optional. Use when createCustomEnvironment == false.

The space-delimited list of additional arguments to pass to the conda install command.


:::moniker-end

:::moniker range=">=azure-pipelines-2019"

createOptions - Other options for conda create
string. Optional. Use when createCustomEnvironment == true.

The space-delimited list of additional options to pass to the conda create command.


:::moniker-end

:::moniker range=">=azure-pipelines-2019"

cleanEnvironment - Clean the environment
boolean. Optional. Use when createCustomEnvironment == true. Default value: false.

Deletes the environment and recreates it if it already exists. If this boolean is not selected, the task will reactivate an existing environment.


:::moniker-end

Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

:::moniker range=">=azure-pipelines-2019"

None.

:::moniker-end

Remarks

Use this task to create and activate a Conda environment.

Important

This task has been deprecated. Use conda commands directly in the bash task or batch script task as an alternative.

This task will create a Conda environment and activate it for subsequent build tasks.

If the task finds an existing environment with the same name, the task will simply reactivate it. This is possible on self-hosted agents. To recreate the environment and reinstall any of its packages, set the "Clean the environment" option.

Running with the "Update to the latest Conda" option will attempt to update Conda before creating or activating the environment. If you are running a self-hosted agent and have configured a Conda installation to work with the task, this may result in your Conda installation being updated.

Note

Microsoft-hosted agents won't have Conda in their PATH by default. You will need to run this task in order to use Conda.

After running this task, PATH will contain the binary directory for the activated environment, followed by the binary directories for the Conda installation itself. You can run scripts as subsequent build tasks that run Python, Conda, or the command-line utilities from other packages you install. For example, you can run tests with pytest or upload a package to Anaconda Cloud with the Anaconda client.

Tip

After running this task, the environment will be "activated," and packages you install by calling conda install will get installed to this environment.

Prerequisites

  • A Microsoft-hosted agent, or a self-hosted agent with Anaconda or Miniconda installed.
  • If using a self-hosted agent, you must either add the conda executable to PATH or set the CONDA environment variable to the root of the Conda installation.

How can I configure a self-hosted agent to use this task?

You can use this task either with a full Anaconda installation or a Miniconda installation. If using a self-hosted agent, you must add the conda executable to PATH. Alternatively, you can set the CONDA environment variable to the root of the Conda installation -- that is, the directory you specify as the "prefix" when installing Conda.

Requirements

:::moniker range=">=azure-pipelines-2019"

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Package

:::moniker-end