Conda Environment task
Azure DevOps Services
Use this task to create and activate a Conda environment.
Note
This task has been deprecated. Use conda 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.
Demands
None
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
condaexecutable toPATHor set theCONDAenvironment variable to the root of the Conda installation.
YAML snippet
# Conda environment
# This task is deprecated. Use `conda` directly in script to work with Anaconda environments.
- task: CondaEnvironment@1
inputs:
#createCustomEnvironment: # Optional
#environmentName: # Required when createCustomEnvironment == True
#packageSpecs: 'python=3' # Optional
#updateConda: true # Optional
#installOptions: # Optional
#createOptions: # Optional
#cleanEnvironment: # Optional
Arguments
| Argument | Description |
|---|---|
createCustomEnvironmentCreate custom environment |
(Optional) Setting this to true creates or reactivates a Conda environment instead of using the base environment. This is recommended for self-hosted agents. Default value: false |
environmentNameEnvironment name |
(Required) Name of the Conda environment to create and activate. |
packageSpecs Package specs |
(Optional) Space-delimited list of packages to install when creating the environment. Default value: python=3 |
updateConda Update to the latest Conda |
(Optional) Update Conda to the latest version. This applies to the Conda installation found in PATH or at the path specified by the CONDA environment variable. Default value: true |
installOptions Other options for conda install |
(Optional) Space-delimited list of additional arguments to pass to the conda install command. |
createOptions Other options for conda create |
(Optional) Space-delimited list of other options to pass to the conda create command. |
cleanEnvironment Clean the environment |
(Optional) Delete the environment and recreate it if it already exists. If not selected, the task will reactivate an existing environment. Default value: false |
Open source
This task is open source on GitHub. Feedback and contributions are welcome.
FAQ
Do I need an agent?
You need at least one agent to run your build or release.
I'm having problems. How can I troubleshoot them?
See Troubleshoot Build and Release.
I can't select a default agent pool and I can't queue my build or release. How do I fix this?
See Agent pools.
My NuGet push task is failing with the following error: "Error: unable to get local issuer certificate". How can I fix this?
This can be fixed by adding a trusted root certificate. You can either add the NODE_EXTRA_CA_CERTS=file environment variable to your build agent, or you can add the NODE.EXTRA.CA.CERTS=file task variable in your pipeline. See Node.js documentation for more details about this variable. See Set variables in a pipeline for instructions on setting a variable in your pipeline.
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.
Maklum balas
Kirim dan lihat maklum balas untuk