Skip to content

Commit 43fde64

Browse files
committed
move uv to be after venv
1 parent 89c5e17 commit 43fde64

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

content/how-tos/how-to-create-environments.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,44 @@ source science/bin/activate
5959
You can find more information on using venv for packaging
6060
[here](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/).
6161

62+
### Set up a virtual environment using uv
63+
64+
To create a new environment using uv in a project folder called `science`,
65+
navigate to that folder and execute:
66+
67+
```shell
68+
uv venv
69+
```
70+
71+
Start using your environment by activating it:
72+
73+
```shell
74+
source .venv/bin/activate
75+
```
76+
77+
You are now ready to install Scientific Python packages using `uv`!
78+
For example:
79+
80+
```shell
81+
uv pip install ipython numpy scipy
82+
```
83+
84+
To install dependencies from a requirements file, use:
85+
86+
```shell
87+
uv pip install -f </path/to/requirements.txt>
88+
```
89+
90+
Remember to re-activate your environment time you open a new terminal:
91+
92+
```shell
93+
cd <path/to/science/>
94+
source .venv/bin/activate
95+
```
96+
97+
You can find more information on using uv for environments
98+
[here](https://docs.astral.sh/uv/pip/environments/#creating-a-virtual-environment).
99+
62100
### Set up an environment using conda
63101

64102
With conda, we can create a new environment named science (-n is the same as passing --name):
@@ -133,44 +171,6 @@ mamba activate science
133171
You can find more information on using mamba in the
134172
[mamba user guide](https://mamba.readthedocs.io/en/latest/user_guide/mamba.html).
135173

136-
### Set up a virtual environment using uv
137-
138-
To create a new environment using uv in a project folder called `science`,
139-
navigate to that folder and execute:
140-
141-
```shell
142-
uv venv
143-
```
144-
145-
Start using your environment by activating it:
146-
147-
```shell
148-
source .venv/bin/activate
149-
```
150-
151-
You are now ready to install Scientific Python packages using `uv`!
152-
For example:
153-
154-
```shell
155-
uv pip install ipython numpy scipy
156-
```
157-
158-
To install dependencies from a requirements file, use:
159-
160-
```shell
161-
uv pip install -f </path/to/requirements.txt>
162-
```
163-
164-
Remember to re-activate your environment time you open a new terminal:
165-
166-
```shell
167-
cd <path/to/science/>
168-
source .venv/bin/activate
169-
```
170-
171-
You can find more information on using uv for environments
172-
[here](https://docs.astral.sh/uv/pip/environments/#creating-a-virtual-environment).
173-
174174
### Set up a virtual environment using pixi
175175

176176
To initialize a new project with pixi in our project called `science`, execute:

0 commit comments

Comments
 (0)