Skip to content

Commit 46a342b

Browse files
authored
Merge pull request #10751 from wiggin15/main
Fix inconsistency in dependency resolution documentation
2 parents 58a01ff + abb109e commit 46a342b

File tree

2 files changed

+28
-26
lines changed

2 files 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
@@ -175,22 +175,24 @@ When you get a `ResolutionImpossible` error, you might see something
175175
like this:
176176

177177
```{pip-cli}
178-
$ pip install "pytest < 4.6" pytest-cov==2.12.1
178+
$ pip install package_coffee==0.44.1 package_tea==4.3.0
179179
[regular pip output]
180-
ERROR: Cannot install pytest-cov==2.12.1 and pytest<4.6 because these package versions have conflicting dependencies.
180+
ERROR: Cannot install package_coffee==0.44.1 and package_tea==4.3.0 because these package versions have conflicting dependencies.
181181
182182
The conflict is caused by:
183-
The user requested pytest<4.6
184-
pytest-cov 2.12.1 depends on pytest>=4.6
183+
package_coffee 0.44.1 depends on package_water<3.0.0,>=2.4.2
184+
package_tea 4.3.0 depends on package_water==2.3.1
185185
```
186186

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

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

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

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

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

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

242244
To find a version of both `package_coffee` and `package_tea` that depend on
243245
the same version of `package_water`, you might consider:
@@ -252,20 +254,20 @@ In the second case, pip will automatically find a version of both
252254
`package_coffee` and `package_tea` that depend on the same version of
253255
`package_water`, installing:
254256

255-
- `package_coffee 0.46.0b0`, which depends on `package_water 2.6.1`
256-
- `package_tea 4.3.0` which _also_ depends on `package_water 2.6.1`
257+
- `package_coffee 0.44.1`, which depends on `package_water 2.6.1`
258+
- `package_tea 4.4.3` which _also_ depends on `package_water 2.6.1`
257259

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

261263
```{pip-cli}
262-
$ pip install package_coffee==0.44.1b0 package_tea
264+
$ pip install package_coffee==0.44.1 package_tea
263265
```
264266

265267
This will result in:
266268

267-
- `package_coffee 0.44.1b0`, which depends on `package_water 2.6.1`
268-
- `package_tea 4.1.3` which also depends on `package_water 2.6.1`
269+
- `package_coffee 0.44.1`, which depends on `package_water 2.6.1`
270+
- `package_tea 4.4.3` which _also_ depends on `package_water 2.6.1`
269271

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

news/10751.trivial.rst

Whitespace-only changes.

0 commit comments

Comments
 (0)