Skip to content

Commit f5126df

Browse files
committed
Update Anaconda documentation for clarity and accuracy
1 parent 2e56fac commit f5126df

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

docs/pipelines/ecosystems/anaconda.md

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: Run pipelines with Anaconda environments
33
description: Set up and use Anaconda environments with Azure Pipelines, Azure DevOps
4-
ms.topic: quickstart
4+
ms.topic: how-to
55
ms.assetid: 50ed6bb4-5f35-4e1e-aafc-295eb10198df
6-
ms.date: 01/24/2022
6+
ms.date: 09/23/2025
77
monikerRange: azure-devops
88
author: JuliaKM
99
---
@@ -12,7 +12,7 @@ author: JuliaKM
1212

1313
[!INCLUDE [version-eq-azure-devops](../../includes/version-eq-azure-devops.md)]
1414

15-
Learn how to set up and use Anaconda with Python in your pipeline. Anaconda is a Python distribution for data science and machine learning.
15+
Set up and use Anaconda with Python in your pipeline. Anaconda is a Python distribution for data science and machine learning.
1616

1717
## Get started
1818

@@ -28,18 +28,18 @@ Follow these instructions to set up a pipeline for a sample Python app with Anac
2828

2929
1. When the list of repositories appears, select your Anaconda sample repository.
3030

31-
1. Azure Pipelines will analyze the code in your repository and detect an existing `azure-pipelines.yml` file.
31+
1. Azure Pipelines analyzes the code in your repository and detects an existing `azure-pipelines.yml` file.
3232

3333
1. Select **Run**.
3434

3535
1. A new run is started. Wait for the run to finish.
3636

3737
> [!TIP]
38-
> To make changes to the YAML file as described in this topic, select the pipeline in the **Pipelines** page, and then **Edit** the `azure-pipelines.yml` file.
38+
> To make changes to the YAML file as described in this article, select the pipeline in the **Pipelines** page, and then **Edit** the `azure-pipelines.yml` file.
3939
4040
## Add conda to your system path
4141

42-
On [hosted agents](../agents/hosted.md), conda is left out of `PATH` by default to keep its Python version from conflicting with other installed versions. The `task.prependpath` agent command will make it available to all subsequent steps.
42+
On [hosted agents](../agents/hosted.md), conda isn't included in `PATH` by default to prevent its Python version from conflicting with other installed versions. Use the `task.prependpath` agent command to make conda available to all later steps.
4343

4444
# [Ubuntu](#tab/ubuntu)
4545

@@ -56,8 +56,8 @@ Use the `macOS-latest` agent with Anaconda.
5656
- bash: echo "##vso[task.prependpath]$CONDA/bin"
5757
displayName: Add conda to PATH
5858
59-
# On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation directory/
60-
# We need to take ownership if we want to update conda or install packages globally
59+
# On hosted macOS, the agent user doesn't own Miniconda's installation directory.
60+
# Take ownership if you want to update conda or install packages globally.
6161
- bash: sudo chown -R $USER $CONDA
6262
displayName: Take ownership of conda installation
6363
```
@@ -75,7 +75,7 @@ Use the `macOS-latest` agent with Anaconda.
7575

7676
### From command-line arguments
7777

78-
The `conda create` command will create an environment with the arguments you pass it.
78+
The `conda create` command creates an environment with the arguments you pass.
7979

8080
# [Ubuntu](#tab/ubuntu)
8181

@@ -99,7 +99,7 @@ The `conda create` command will create an environment with the arguments you pas
9999
```
100100

101101
> [!NOTE]
102-
> To add specific conda channels, you need to add an extra line for conda config:
102+
> To add specific conda channels, add an extra line for conda config:
103103
> `conda config --add channels conda-forge`
104104

105105

@@ -115,15 +115,10 @@ You can check in an [`environment.yml`](https://conda.io/docs/user-guide/tasks/m
115115
```
116116

117117
> [!NOTE]
118-
> If you are using a self-hosted agent and don't remove the environment at the end, you'll get an
119-
> error on the next build since the environment already exists. To resolve, use the `--force`
120-
> argument: `conda env create --quiet --force --file environment.yml`.
118+
> If you use a self-hosted agent and don't remove the environment at the end, you get an error on the next build because the environment already exists. To fix this, remove the environment before creating a new one with `conda env remove --name your-env-name`.
121119

122120
> [!NOTE]
123-
> If you are using self-hosted agents that are sharing storage, and running jobs in parallel
124-
> using the same Anaconda environments, there may be clashes between those environments.
125-
> To resolve, use the `--name` argument and a unique identifier as the argument value,
126-
> like a concatenation with the `$(Build.BuildNumber)` build variable.
121+
> If you use self-hosted agents that share storage and run jobs in parallel using the same Anaconda environments, there can be clashes between those environments. To fix this, use the `--name` argument and a unique identifier as the argument value, like a concatenation with the `$(Build.BuildNumber)` build variable.
127122

128123
### Install packages from Anaconda
129124

@@ -133,7 +128,7 @@ The following YAML installs the `scipy` package in the conda environment named `
133128

134129
```yaml
135130
- bash: |
136-
source activate myEnvironment
131+
conda activate myEnvironment
137132
conda install --yes --quiet --name myEnvironment scipy
138133
displayName: Install Anaconda packages
139134
```
@@ -142,7 +137,7 @@ The following YAML installs the `scipy` package in the conda environment named `
142137

143138
```yaml
144139
- bash: |
145-
source activate myEnvironment
140+
conda activate myEnvironment
146141
conda install --yes --quiet --name myEnvironment scipy
147142
displayName: Install Anaconda packages
148143
```
@@ -162,14 +157,14 @@ The following YAML installs the `scipy` package in the conda environment named `
162157

163158
> [!NOTE]
164159
> Each build step runs in its own process.
165-
> When you activate an Anaconda environment, it will edit `PATH` and make other changes to its current process.
166-
> Therefore, an Anaconda environment must be activated separately for each step.
160+
> When you activate an Anaconda environment, it edits `PATH` and makes other changes to its current process.
161+
> So, activate an Anaconda environment separately for each step.
167162

168163
# [Ubuntu](#tab/ubuntu)
169164

170165
```yaml
171166
- bash: |
172-
source activate myEnvironment
167+
conda activate myEnvironment
173168
python -m pytest --junitxml=junit/unit-test.xml
174169
displayName: pytest
175170
@@ -183,7 +178,7 @@ The following YAML installs the `scipy` package in the conda environment named `
183178

184179
```yaml
185180
- bash: |
186-
source activate myEnvironment
181+
conda activate myEnvironment
187182
pytest --junitxml=junit/unit-test.xml
188183
displayName: pytest
189184
@@ -209,18 +204,19 @@ The following YAML installs the `scipy` package in the conda environment named `
209204

210205
---
211206

212-
## FAQs
207+
208+
## FAQ
213209

214210
### Why am I getting a "Permission denied" error?
215-
On Hosted macOS, the agent user does not have ownership of the directory where Miniconda is installed.
216-
For a fix, see the "Hosted macOS" tab under [Add conda to your system path](#add-conda-to-your-system-path).
211+
On hosted macOS, the agent user doesn't own the directory where Miniconda is installed.
212+
To fix this issue, go to the "Hosted macOS" tab under [Add conda to your system path](#add-conda-to-your-system-path).
217213

218214
### Why does my build stop responding on a `conda create` or `conda install` step?
219-
If you forget to pass `--yes`, conda will stop and wait for user interaction.
215+
If you don't pass `--yes`, conda stops and waits for user input.
220216

221217
### Why is my script on Windows stopping after it activates the environment?
222218
On Windows, `activate` is a Batch script. You must use the [`call`](/windows-server/administration/windows-commands/call) command to resume running your script after activating.
223219
See examples of using `call` [in a pipeline](#run-pipeline-steps-in-an-anaconda-environment).
224220

225221
### How can I run my tests with multiple versions of Python?
226-
See [Build Python apps in Azure Pipelines](./python.md).
222+
Go to [Build Python apps in Azure Pipelines](./python.md).

0 commit comments

Comments
 (0)