Skip to content

Commit 6802965

Browse files
author
Arnon Yaari
committed
Fix inconsistency in dependency resolution documentation
1 parent 7f8a684 commit 6802965

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

docs/html/topics/dependency-resolution.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,24 @@ When you get a `ResolutionImpossible` error, you might see something
173173
like this:
174174

175175
```{pip-cli}
176-
$ pip install "pytest < 4.6" pytest-cov==2.12.1
176+
$ pip install package_coffee==0.44.1 package_tea==4.3.0
177177
[regular pip output]
178-
ERROR: Cannot install pytest-cov==2.12.1 and pytest<4.6 because these package versions have conflicting dependencies.
178+
ERROR: Cannot install package_coffee==0.44.1 and package_tea==4.3.0 because these package versions have conflicting dependencies.
179179
180180
The conflict is caused by:
181-
The user requested pytest<4.6
182-
pytest-cov 2.12.1 depends on pytest>=4.6
181+
package_coffee 0.44.1 depends on package_water<3.0.0,>=2.4.2
182+
package_tea 4.3.0 depends on package_water==2.3.1
183183
```
184184

185-
In this example, pip cannot install the packages requested because they are
186-
asking for conflicting versions of pytest.
185+
In this example, pip cannot install the packages you have requested,
186+
because they each depend on different versions of the same package
187+
(``package_water``):
187188

188-
- `pytest-cov` version `2.12.1`, requires `pytest` with a version or equal to
189-
`4.6`.
190-
- `package_tea` version `4.3.0` depends on version `2.3.1` of
191-
`package_water`
189+
- ``package_coffee`` version ``0.44.1`` depends on a version of
190+
``package_water`` that is less than ``3.0.0`` but greater than or equal to
191+
``2.4.2``
192+
- ``package_tea`` version ``4.3.0`` depends on version ``2.3.1`` of
193+
``package_water``
192194

193195
Sometimes these messages are straightforward to read, because they use
194196
commonly understood comparison operators to specify the required version
@@ -197,16 +199,16 @@ commonly understood comparison operators to specify the required version
197199
However, Python packaging also supports some more complex ways for
198200
specifying package versions (e.g. `~=` or `*`):
199201

200-
| Operator | Description | Example |
201-
| -------- | -------------------------------------------------------------- | --------------------------------------------------- |
202-
| `>` | Any version greater than the specified version. | `>3.1`: any version greater than `3.1`. |
203-
| `<` | Any version less than the specified version. | `<3.1`: any version less than `3.1`. |
204-
| `<=` | Any version less than or equal to the specified version. | `<=3.1`: any version less than or equal to `3.1`. |
205-
| `>=` | Any version greater than or equal to the specified version. | `>=3.1`: version `3.1` and greater. |
206-
| `==` | Exactly the specified version. | `==3.1`: only `3.1`. |
207-
| `!=` | Any version not equal to the specified version. | `!=3.1`: any version other than `3.1`. |
208-
| `~=` | Any compatible{sup}`1` version. | `~=3.1`: any version compatible{sup}`1` with `3.1`. |
209-
| `*` | Can be used at the end of a version number to represent _all_. | `==3.1.*`: any version that starts with `3.1`. |
202+
| Operator | Description | Example |
203+
| -------- | -------------------------------------------------------------- | ---------------------------------------------------- |
204+
| `>` | Any version greater than the specified version. | `>3.1`: any version greater than `3.1`. |
205+
| `<` | Any version less than the specified version. | `<3.1`: any version less than `3.1`. |
206+
| `<=` | Any version less than or equal to the specified version. | `<=3.1`: any version less than or equal to `3.1`. |
207+
| `>=` | Any version greater than or equal to the specified version. | `>=3.1`: any version greater than or equal to `3.1`. |
208+
| `==` | Exactly the specified version. | `==3.1`: only version `3.1`. |
209+
| `!=` | Any version not equal to the specified version. | `!=3.1`: any version other than `3.1`. |
210+
| `~=` | Any compatible{sup}`1` version. | `~=3.1`: any version compatible{sup}`1` with `3.1`. |
211+
| `*` | Can be used at the end of a version number to represent _all_. | `==3.1.*`: any version that starts with `3.1`. |
210212

211213
{sup}`1` Compatible versions are higher versions that only differ in the final segment.
212214
`~=3.1.2` is equivalent to `>=3.1.2, ==3.1.*`. `~=3.1` is equivalent to `>=3.1, ==3.*`.
@@ -235,7 +237,7 @@ package version.
235237

236238
In our first example both `package_coffee` and `package_tea` have been
237239
_pinned_ to use specific versions
238-
(`package_coffee==0.44.1b0 package_tea==4.3.0`).
240+
(`package_coffee==0.44.1 package_tea==4.3.0`).
239241

240242
To find a version of both `package_coffee` and `package_tea` that depend on
241243
the same version of `package_water`, you might consider:
@@ -250,20 +252,20 @@ In the second case, pip will automatically find a version of both
250252
`package_coffee` and `package_tea` that depend on the same version of
251253
`package_water`, installing:
252254

253-
- `package_coffee 0.46.0b0`, which depends on `package_water 2.6.1`
254-
- `package_tea 4.3.0` which _also_ depends on `package_water 2.6.1`
255+
- `package_coffee 0.44.1`, which depends on `package_water 2.6.1`
256+
- `package_tea 4.4.3` which _also_ depends on `package_water 2.6.1`
255257

256258
If you want to prioritize one package over another, you can add version
257259
specifiers to _only_ the more important package:
258260

259261
```{pip-cli}
260-
$ pip install package_coffee==0.44.1b0 package_tea
262+
$ pip install package_coffee==0.44.1 package_tea
261263
```
262264

263265
This will result in:
264266

265-
- `package_coffee 0.44.1b0`, which depends on `package_water 2.6.1`
266-
- `package_tea 4.1.3` which also depends on `package_water 2.6.1`
267+
- `package_coffee 0.44.1`, which depends on `package_water 2.6.1`
268+
- `package_tea 4.4.3` which _also_ depends on `package_water 2.6.1`
267269

268270
Now that you have resolved the issue, you can repin the compatible
269271
package versions as required.

0 commit comments

Comments
 (0)