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