@@ -25,33 +25,33 @@ needed dependencies for a project.
2525
2626With venv to create environment associated with a project folder called ` science ` .
2727
28- ```
28+ ``` shell
2929python -m venv science
3030```
3131
3232Start using it by activating it as follows:
3333
34- ```
34+ ``` shell
3535source science/bin/activate
3636```
3737
3838You are now ready to install Scientific Python packages using ` pip ` ! For example:
3939
40- ```
40+ ``` shell
4141pip install ipython numpy scipy
4242```
4343
4444Often you'll interact with projects that have a specific list of dependencies (for development
4545environments, testing environments, or the project itself). You can install the list of dependencies
4646with pip in your venv using:
4747
48- ```
48+ ``` shell
4949pip install -r < path/to/requirements.txt>
5050```
5151
5252Remember to re-activate your environment every time you open a new terminal, using:
5353
54- ```
54+ ``` shell
5555source science/bin/activate
5656```
5757
@@ -62,34 +62,34 @@ You can find more information on using venv for packaging
6262
6363With conda, we can create a new environment named science (-n is the same as passing --name):
6464
65- ```
65+ ``` shell
6666conda create -n science
6767```
6868
6969Start using your environment by activating it:
7070
71- ```
71+ ``` shell
7272conda activate science
7373```
7474
7575You are now ready to install Scientific Python packages using ` conda ` !
7676For example:
7777
78- ```
78+ ``` shell
7979conda install ipython numpy scipy
8080```
8181
8282Some projects distribute environment files with listed dependencies with an ` environment.yml ` file.
8383The first line of this file sets the environment's name. To
8484create an environment and install the dependencies with this file, use:
8585
86- ```
86+ ``` shell
8787conda env create -f < path/to/environment.yml>
8888```
8989
9090Remember to re-activate your environment every time you open a new terminal:
9191
92- ```
92+ ``` shell
9393conda activate science
9494```
9595
@@ -100,32 +100,32 @@ You can find more information on using conda for environments
100100
101101With mamba, like conda, we can create a new environment named science (-n is the same as passing --name):
102102
103- ```
103+ ``` shell
104104mamba create -n science
105105```
106106
107107Start using your environment by activating it:
108108
109- ```
109+ ``` shell
110110mamba activate science
111111```
112112
113113You are now ready to install Scientific Python packages using ` mamba ` !
114114For example:
115115
116- ```
116+ ``` shell
117117mamba install ipython numpy scipy
118118```
119119
120120To install a specific environment from a ` .yml ` file, use:
121121
122- ```
122+ ``` shell
123123mamba create -f < /path/to/environment.yml>
124124```
125125
126126Remember to re-activate your environment every time you open a new terminal:
127127
128- ```
128+ ``` shell
129129mamba activate science
130130```
131131
@@ -134,34 +134,35 @@ You can find more information on using mamba in the
134134
135135### Set up a virtual environment using uv
136136
137- To create a new environment using uv in our project folder called ` science ` :
137+ To create a new environment using uv in a project folder called ` science ` ,
138+ navigate to that folder and execute:
138139
139- ```
140+ ``` shell
140141uv venv
141142```
142143
143144Start using your environment by activating it:
144145
145- ```
146+ ``` shell
146147source .venv/bin/activate
147148```
148149
149150You are now ready to install Scientific Python packages using ` uv ` !
150151For example:
151152
152- ```
153+ ``` shell
153154uv pip install ipython numpy scipy
154155```
155156
156157To install dependencies from a requirements file, use:
157158
158- ```
159+ ``` shell
159160uv pip install -f < /path/to/requirements.txt>
160161```
161162
162163Remember to re-activate your environment time you open a new terminal:
163164
164- ```
165+ ``` shell
165166source < path/to/science/> .venv/bin/activate
166167```
167168
@@ -172,34 +173,37 @@ You can find more information on using uv for environments
172173
173174To initialize a new project with pixi in our project called ` science ` , execute:
174175
175- ```
176+ ``` shell
176177pixi init
177178```
178179
179180You are now ready to install Scientific Python packages as dependencies in this project!
180181From the science directory, execute:
181182
182- ```
183+ ``` shell
183184pixi add ipython numpy scipy
184185```
185186
186187To install dependencies from a file like ` environment.yml ` , use:
187188
188- ```
189+ ``` shell
189190pixi init --import < path/to/environment.yml>
190191```
191192
192193Remember to re-activate your environment when you re-open a terminal. Navigate to
193194the science folder, and execute:
194195
195- ```
196+ ``` shell
196197pixi shell
197198```
198199
200+ This will drop you into the default environment for the pixi project, with all
201+ dependencies in that environment accessible to you in that shell.
202+
199203A pixi project may have multiple environments defined in the ` pixi.toml ` file. To
200204load a specific environment:
201205
202- ```
206+ ``` shell
203207pixi shell --environment=< envname>
204208```
205209
0 commit comments