@@ -43,7 +43,7 @@ environments, testing environments, or the project itself). You can install the
43
43
with pip in your venv using:
44
44
45
45
```
46
- pip install -r requirements.txt
46
+ pip install -r <path/to/ requirements.txt>
47
47
```
48
48
49
49
Remember to re-activate your environment every time you open a new terminal, using:
@@ -52,7 +52,7 @@ Remember to re-activate your environment every time you open a new terminal, usi
52
52
source science/bin/activate
53
53
```
54
54
55
- ### Set up a virtual environment using conda
55
+ ### Set up an environment using conda
56
56
57
57
With conda, we can create a new environment named science (-n is the same as passing --name):
58
58
@@ -73,12 +73,12 @@ For example:
73
73
conda install ipython numpy scipy
74
74
```
75
75
76
- Often you'll interact with projects that have a specific list of dependencies (for development
77
- environments, testing environments, or the project itself). You can install the list of dependencies
78
- with conda in your environment using :
76
+ Some projects distribute environment files with listed dependencies with an ` environment.yml ` file.
77
+ The first line of this file sets the environment's name. To
78
+ create an environment and install the dependencies with this file, use :
79
79
80
80
```
81
- conda install --file requirements.txt
81
+ conda env create -f <path/to/environment.yml>
82
82
```
83
83
84
84
Remember to re-activate your environment every time you open a new terminal:
@@ -87,7 +87,7 @@ Remember to re-activate your environment every time you open a new terminal:
87
87
conda activate science
88
88
```
89
89
90
- ### Set up a virtual environment using mamba
90
+ ### Set up an environment using mamba
91
91
92
92
With mamba, like conda, we can create a new environment named science (-n is the same as passing --name):
93
93
@@ -108,16 +108,94 @@ For example:
108
108
mamba install ipython numpy scipy
109
109
```
110
110
111
- Often you'll interact with projects that have a specific list of dependencies (for development
112
- environments, testing environments, or the project itself). You can install the list of dependencies
113
- with mamba in your environment using:
111
+ To install a specific environment from a ` .yml ` file, use:
114
112
115
113
```
116
- mamba install --file requirements.txt
114
+ mamba create -f </path/to/environment.yml>
117
115
```
118
116
119
117
Remember to re-activate your environment every time you open a new terminal:
120
118
121
119
```
122
120
mamba activate science
123
121
```
122
+
123
+ ### Set up a virtual environment using uv
124
+
125
+ To create a new environment using uv in our project folder called ` science ` :
126
+
127
+ ```
128
+ uv venv
129
+ ```
130
+
131
+ Start using your environment by activating it:
132
+
133
+ ```
134
+ source .venv/bin/activate
135
+ ```
136
+
137
+ You are now ready to install Scientific Python packages using ` uv ` !
138
+ For example:
139
+
140
+ ```
141
+ uv pip install ipython numpy scipy
142
+ ```
143
+
144
+ To install dependencies from a requirements file, use:
145
+
146
+ ```
147
+ uv pip install -f </path/to/requirements.txt>
148
+ ```
149
+
150
+ Remember to re-activate your environment time you open a new terminal:
151
+
152
+ ```
153
+ source <path/to/science/>.venv/bin/activate
154
+ ```
155
+
156
+ You can find more information on using uv for environments
157
+ [ here] ( https://docs.astral.sh/uv/pip/environments/#creating-a-virtual-environment ) .
158
+
159
+ ### Set up a virtual environment using pixi
160
+
161
+ To initialize a new project with pixi in our project called ` science ` , execute:
162
+
163
+ ```
164
+ pixi init
165
+ ```
166
+
167
+ You are now ready to install Scientific Python packages as dependencies in this project!
168
+ From the science directory, execute:
169
+
170
+ ```
171
+ pixi add ipython numpy scipy
172
+ ```
173
+
174
+ To install dependencies from a file like ` environment.yml ` , use:
175
+
176
+ ```
177
+ pixi init --import <path/to/environment.yml>
178
+ ```
179
+
180
+ Remember to re-activate your environment when you re-open a terminal. Navigate to
181
+ the science folder, and execute:
182
+
183
+ ```
184
+ pixi shell
185
+ ```
186
+
187
+ A pixi project may have multiple environments defined in the ` pixi.toml ` file. To
188
+ load a specific environment:
189
+
190
+ ```
191
+ pixi shell --environment=<envname>
192
+ ```
193
+
194
+ You can find more information on using pixi
195
+ [ here] ( https://docs.astral.sh/uv/pip/environments/#creating-a-virtual-environment ) .
196
+
197
+
198
+
199
+
200
+
201
+
0 commit comments