@@ -175,22 +175,24 @@ When you get a `ResolutionImpossible` error, you might see something
175
175
like this:
176
176
177
177
``` {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
179
179
[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.
181
181
182
182
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
185
185
```
186
186
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 `` ):
189
190
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 ``
194
196
195
197
Sometimes these messages are straightforward to read, because they use
196
198
commonly understood comparison operators to specify the required version
@@ -199,16 +201,16 @@ commonly understood comparison operators to specify the required version
199
201
However, Python packaging also supports some more complex ways for
200
202
specifying package versions (e.g. ` ~= ` or ` * ` ):
201
203
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 ` . |
212
214
213
215
{sup}` 1 ` Compatible versions are higher versions that only differ in the final segment.
214
216
` ~=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.
237
239
238
240
In our first example both ` package_coffee ` and ` package_tea ` have been
239
241
_ 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 ` ).
241
243
242
244
To find a version of both ` package_coffee ` and ` package_tea ` that depend on
243
245
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
252
254
` package_coffee ` and ` package_tea ` that depend on the same version of
253
255
` package_water ` , installing:
254
256
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 `
257
259
258
260
If you want to prioritize one package over another, you can add version
259
261
specifiers to _ only_ the more important package:
260
262
261
263
``` {pip-cli}
262
- $ pip install package_coffee==0.44.1b0 package_tea
264
+ $ pip install package_coffee==0.44.1 package_tea
263
265
```
264
266
265
267
This will result in:
266
268
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 `
269
271
270
272
Now that you have resolved the issue, you can repin the compatible
271
273
package versions as required.
0 commit comments