@@ -29,6 +29,7 @@ One of the easiest ways to mess up a conda installation is to install a bunch of
29
29
## Install * micromamba*
30
30
31
31
### Run the installer
32
+
32
33
Install ` micromamba ` , the executable we will use to manage our virtual environments.
33
34
34
35
=== "MacOS/Linux"
@@ -39,19 +40,19 @@ Install `micromamba`, the executable we will use to manage our virtual environme
39
40
```console
40
41
$ "${SHELL}" <(curl -L micro.mamba.pm/install.sh)
41
42
---> 100%
42
-
43
+
43
44
// You will be asked whether you want to initialise your shell.
44
45
// Respond "Y".
45
-
46
+
46
47
Init shell? [Y/n] Y
47
-
48
+
48
49
// You will be asked where you want to install micromamba.
49
50
// Using the default is recommended.
50
-
51
+
51
52
Prefix location? [~/micromamba]
52
-
53
+
53
54
// You will need to restart your shell for changes to take effect.
54
-
55
+
55
56
Please restart your shell to activate micromamba.
56
57
```
57
58
@@ -60,26 +61,26 @@ Install `micromamba`, the executable we will use to manage our virtual environme
60
61
Next, setup `micromamba` to download packages from
61
62
[*conda-forge*](https://conda-forge.org/)
62
63
a community driven package repository.
63
-
64
+
64
65
<div class="termy">
65
-
66
+
66
67
```console
67
68
$ micromamba config append channels conda-forge
68
69
$ micromamba config append channels nodefaults
69
70
$ micromamba config set channel_priority strict
70
71
```
71
-
72
+
72
73
</div>
73
74
74
75
=== "Windows"
75
76
76
77
todo: add windows guide
77
-
78
- ### Set up an alias
78
+
79
+ ### Set up an alias
79
80
80
81
!!!tip "set up an alias for micromamba"
81
82
` micromamba ` replaces ` conda ` . Set up an alias if you want to type ` conda ` at the prompt.
82
-
83
+
83
84
=== "bash"
84
85
85
86
```bash title="~/.bashrc"
@@ -91,9 +92,9 @@ Install `micromamba`, the executable we will use to manage our virtual environme
91
92
```zsh title="~/.zshrc"
92
93
alias conda="micromamba"
93
94
```
94
-
95
+
95
96
=== "PowerShell"
96
-
97
+
97
98
```PowerShell title="$Home\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
98
99
Set-Alias conda mamba
99
100
```
@@ -107,45 +108,42 @@ We will use `conda` at the prompt rather than `micromamba` for the rest of this
107
108
Run the following to create and activate an environment called ` my-env ` with Python 3.10
108
109
109
110
<div class =" termy " >
110
-
111
+
111
112
```console
112
113
$ conda create --name my-env python=3.10
113
-
114
+
114
115
// To work in the environment we first need to activate it.
115
-
116
+
116
117
$ conda activate my-env
117
-
118
+
118
119
// Your prompt will indicate your current environment.
119
-
120
- $ (my-env) ➜
121
-
120
+
121
+ $ (my-env) ➜
122
+
122
123
// Let's check that we have the correct Python version.
123
-
124
+
124
125
$ (my-env) ➜ python --version
125
126
Python 3.10.10
126
-
127
+
127
128
```
128
129
129
130
</div >
130
131
131
-
132
-
133
132
### Installing packages
134
133
135
134
You can install most packages into your environment with ` conda ` or ` pip ` .
136
- Install what you can with ` conda ` . If a package is available on
135
+ Install what you can with ` conda ` . If a package is available on
137
136
[ PyPI] ( https://pypi.org/ ) but not [ conda-forge] ( https://conda-forge.org/ ) then use ` pip ` .
138
137
139
138
=== "conda"
140
139
141
140
<div class="termy">
142
-
141
+
143
142
```console
144
143
$ (my-env) ➜ conda install numpy
145
144
```
146
145
147
146
</div>
148
-
149
147
150
148
=== "pip"
151
149
@@ -165,9 +163,9 @@ We can deactivate an environment with
165
163
166
164
```console
167
165
$ (my-env) ➜ conda deactivate
168
-
166
+
169
167
// You are no longer in my-env.
170
-
168
+
171
169
$
172
170
```
173
171
@@ -209,7 +207,7 @@ This is useful for workflows which rely on software with incompatible dependenci
209
207
!!!tip "Get comfy! 🧸"
210
208
Getting comfortable with the creation, destruction, activation and deactivation of environments at will is liberating.
211
209
Practice now!
212
-
210
+
213
211
!!!tip "One environment per project 🌍"
214
212
Working with one environment per project is a useful ideal.
215
213
A general purpose environment can be useful for quick scripts and analysis.
0 commit comments