11---
2- title : How to set up a virtual environment
2+ title : How to set up an environment
33---
44
5- In this guide we summarize some key commands to set up a virtual environment
6- with different tools in the scientific python ecosystem.
7- A virtual environment is a workspace into which you can install Python
5+ In this guide we summarize some key commands to set up an environment
6+ with different tools that you might encounter in the scientific python
7+ ecosystem. An environment is a workspace into which you can install Python
88libraries, separate from what is being used by your operating system.
99
1010The environment managers that are covered in this how-to guide include:
@@ -14,13 +14,16 @@ The environment managers that are covered in this how-to guide include:
1414- uv
1515- pixi
1616
17- In each of these examples we'll create a new virtual environment related to our project called ` science `
18- (you can use whichever name you prefer!). We'll activate the environment, install some dependencies, and see
19- an example of installing dependencies from a file.
17+ In each of these examples we'll create a new virtual environment related to our
18+ project called ` science ` (you can use whichever name you prefer!). We'll activate
19+ the environment, install some dependencies, and see
20+ an example of installing dependencies from an existing file. You may encounter
21+ files like ` requirements.txt ` , ` environment.yml ` or ` pyproject.toml ` that specify
22+ needed dependencies for a project.
2023
2124### Set up a virtual environment with venv
2225
23- With venv we'll have our virtual environment associated with our project folder called ` science ` .
26+ With venv to create environment associated with a project folder called ` science ` .
2427
2528```
2629python -m venv science
@@ -52,6 +55,9 @@ Remember to re-activate your environment every time you open a new terminal, usi
5255source science/bin/activate
5356```
5457
58+ You can find more information on using venv for packaging
59+ [ here] ( https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/ ) .
60+
5561### Set up an environment using conda
5662
5763With conda, we can create a new environment named science (-n is the same as passing --name):
@@ -87,6 +93,9 @@ Remember to re-activate your environment every time you open a new terminal:
8793conda activate science
8894```
8995
96+ You can find more information on using conda for environments
97+ [ here] ( https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html ) .
98+
9099### Set up an environment using mamba
91100
92101With mamba, like conda, we can create a new environment named science (-n is the same as passing --name):
@@ -120,6 +129,9 @@ Remember to re-activate your environment every time you open a new terminal:
120129mamba activate science
121130```
122131
132+ You can find more information on using mamba in the
133+ [ mamba user guide] ( https://mamba.readthedocs.io/en/latest/user_guide/mamba.html ) .
134+
123135### Set up a virtual environment using uv
124136
125137To create a new environment using uv in our project folder called ` science ` :
@@ -192,7 +204,7 @@ pixi shell --environment=<envname>
192204```
193205
194206You can find more information on using pixi
195- [ here] ( https://docs.astral.sh/uv/pip/environments/#creating-a-virtual-environment ) .
207+ [ here] ( https://prefix.dev/docs/pixi/basic_usage ) .
196208
197209
198210
0 commit comments