You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
16
16
17
17
## Get started
18
18
@@ -28,18 +28,18 @@ Follow these instructions to set up a pipeline for a sample Python app with Anac
28
28
29
29
1. When the list of repositories appears, select your Anaconda sample repository.
30
30
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.
32
32
33
33
1. Select **Run**.
34
34
35
35
1. A new run is started. Wait for the run to finish.
36
36
37
37
> [!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.
39
39
40
40
## Add conda to your system path
41
41
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.
43
43
44
44
# [Ubuntu](#tab/ubuntu)
45
45
@@ -56,8 +56,8 @@ Use the `macOS-latest` agent with Anaconda.
56
56
- bash: echo "##vso[task.prependpath]$CONDA/bin"
57
57
displayName: Add conda to PATH
58
58
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.
61
61
- bash: sudo chown -R $USER $CONDA
62
62
displayName: Take ownership of conda installation
63
63
```
@@ -75,7 +75,7 @@ Use the `macOS-latest` agent with Anaconda.
75
75
76
76
### From command-line arguments
77
77
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.
79
79
80
80
# [Ubuntu](#tab/ubuntu)
81
81
@@ -99,7 +99,7 @@ The `conda create` command will create an environment with the arguments you pas
99
99
```
100
100
101
101
> [!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:
103
103
> `conda config --add channels conda-forge`
104
104
105
105
@@ -115,15 +115,10 @@ You can check in an [`environment.yml`](https://conda.io/docs/user-guide/tasks/m
115
115
```
116
116
117
117
> [!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`
> 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`.
121
119
122
120
> [!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.
127
122
128
123
### Install packages from Anaconda
129
124
@@ -133,7 +128,7 @@ The following YAML installs the `scipy` package in the conda environment named `
@@ -162,14 +157,14 @@ The following YAML installs the `scipy` package in the conda environment named `
162
157
163
158
> [!NOTE]
164
159
> 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.
167
162
168
163
# [Ubuntu](#tab/ubuntu)
169
164
170
165
```yaml
171
166
- bash: |
172
-
source activate myEnvironment
167
+
conda activate myEnvironment
173
168
python -m pytest --junitxml=junit/unit-test.xml
174
169
displayName: pytest
175
170
@@ -183,7 +178,7 @@ The following YAML installs the `scipy` package in the conda environment named `
183
178
184
179
```yaml
185
180
- bash: |
186
-
source activate myEnvironment
181
+
conda activate myEnvironment
187
182
pytest --junitxml=junit/unit-test.xml
188
183
displayName: pytest
189
184
@@ -209,18 +204,19 @@ The following YAML installs the `scipy` package in the conda environment named `
209
204
210
205
---
211
206
212
-
## FAQs
207
+
208
+
## FAQ
213
209
214
210
### 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).
217
213
218
214
### 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.
220
216
221
217
### Why is my script on Windows stopping after it activates the environment?
222
218
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.
223
219
See examples of using `call` [in a pipeline](#run-pipeline-steps-in-an-anaconda-environment).
224
220
225
221
### 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