Description
Related to #8377
We need to write documentation to help users when they experience a ResolutionImpossible
error message.
Archived drafts:
Version 1
Fixing conflicting dependencies
Note: the purpose of this documentation is to provide practical suggestions to pip users who encounter an error where pip cannot install their specified packages due to conflicting dependencies (a
ResolutionImpossible
error).
This documentation is not meant to act as a list of PyPA agreed best practices or recommendations, but rather an attempt to help users who find themselves stuck and are unsure what steps they can take to solve their problem.
Understanding your error message
When you get a ResolutionImpossible
error, you might see something like this:
pip install ward==0.44.1b0 py2neo==4.3.0
Due to conflicting dependencies pip cannot install ward and py2neo:
- ward depends on pygments<3.0.0,>=2.4.2
- py2neo depends on pygments~=2.3.1
In this example, pip cannot install the packages you have requested, because they each depend on different versions of the same package (pygments
):
ward
version0.44.1b0
depends on a version ofpygments
that is less than3.0.0
but greater than or equal to2.4.2
py2neo
version4.3.0
depends on apygments
release that is compatible with version2.3.1
Sometimes these messages are straightforward to read, because they use commonly understood comparison operators to specify the required version (e.g. <
or >
).
However, Python packaging also supports some more complex ways for specifying package versions. Here is the full list supported comparison operators:
Operator | Description | Example |
---|---|---|
> |
Any version greater than the specified version | >3.1 : any version greater than 3.1 |
< |
Any version less than the specified version | <3.1 : any version less than 3.1 |
<= |
Any version less than or equal to the specified version | <=3.1 : any version less than or equal to 3.1 |
>= |
Any version greater than or equal to the specified version | >=3.1 : version 3.1 and greater |
== |
Exactly the specified version | ==3.1 : only version 3.1 |
!= |
Any version not equal to the specified version | !=3.1 : any version other than 3.1 |
~= |
Any compatible release. Compatible releases are releases that are within the same major or minor version, assuming the package author is using semantic versioning. | ~=3.1 : version 3.1 or later, but not version 4.0 or later. ~=3.1.2 : version 3.1.2 or later, but not version 3.2.0 or later. |
* |
Can be used at the end of a version number to represent "all" | == 3.1.* : any version that starts with 3.1 . Equivalent to ~=3.1.0 . |
The full specification of supported comparison operators can be found in PEP440.
Error causes
There are three common causes for experiencing a ResolutionImpossible
error.
The cause and possible solution to your error will depend on your individual use case.
1. Your "top level" requirements are too strict
In this scenario, the packages that you have asked pip to install are incompatible, possibly because you have been strict when you specified the package version.
In the example above both ward
and py2neo
have been pinned to use specific versions (ward==0.44.1b0 py2neo==4.3.0
).
To find a version of both ward
and py2neo
that depend on the same version of pygments
, you might consider:
- Loosening the range of packages that you are prepared to install (e.g.
pip install "ward>0.44.*" "py2neo>4.0.0"
) - Asking pip to install any version of
ward
andpy2neo
by removing the version specifiers altogether (e.g.pip install ward py2neo
)
In the second case, pip will automatically find a version of both ward
and py2neo
that depend on the same version of pygments
, installing:
ward 0.46.0b0
, which depends onpygments 2.6.1
py2neo 4.3.0
which also depends onpygments 2.6.1
If you want to prioritise one package over another, you can add version specifiers to only the more important package:
pip install ward==0.44.1b0 py2neo
This will result in:
ward 0.44.1b0
, which depends onpygments 2.6.1
py2neo 4.1.3
which also depends onpygments 2.6.1
Now that you have resolved the issue, you can repin the compatible package versions as required.
2. A package that you are using has requirements that are too strict
You may find yourself in a situation where a package you are trying to install has specific dependency requirements that create a conflict. This is known as a downstream dependency conflict.
Assuming that you cannot resolve the conflict by loosening the version of the package you require (as above), you can try to fix the issue on the package itself by:
- Requesting that the package maintainers loosen their dependencies
- Forking the package and loosening the dependencies yourself
As a general rule, third party modules (libraries) should strive to reduce the the likelihood of causing dependency conflicts with other libraries by keeping their dependency requirements as loose as possible.
3. All requirements are loose, but a solution does not exist
Sometimes it's simply impossible to find a combination of package versions that do not conflict. Welcome to dependency hell.
In this situation, you can consider:
- Using an alternative package, if that is acceptable for your project (see Awesome Python for similar packages)
- Forking and refactoring one of your dependencies to avoid the conflict
Overriding dependency resolution (force installing)
There is currently no way to override pip's mechanism for resolving dependency conflicts and forcing pip to install an incompatible version of a required package.
If you would like to see this functionality please let the pip team know.
Version 2
Fixing conflicting dependencies
Note: the purpose of this documentation is to provide practical suggestions to pip users who encounter an error where pip cannot install their specified packages due to conflicting dependencies (a
ResolutionImpossible
error).
This documentation is not meant to act as a list of PyPA agreed best practices or recommendations, but rather an attempt to help users who find themselves stuck and are unsure what steps they can take to solve their problem.
Understanding your error message
When you get a ResolutionImpossible
error, you might see something like this:
pip install packageA==0.44.1b0 packageB==4.3.0
Due to conflicting dependencies pip cannot install packageA and packageB:
- packageA depends on packageC<3.0.0,>=2.4.2
- packageB depends on packageC~=2.3.1
In this example, pip cannot install the packages you have requested, because they each depend on different versions of the same package (packageC
):
packageA
version0.44.1b0
depends on a version ofpackageC
that is less than3.0.0
but greater than or equal to2.4.2
packageB
version4.3.0
depends on apackageC
release that is compatible with version2.3.1
Sometimes these messages are straightforward to read, because they use commonly understood comparison operators to specify the required version (e.g. <
or >
).
However, Python packaging also supports some more complex ways for specifying package versions. Here is the full list supported comparison operators:
Operator | Description | Example |
---|---|---|
> |
Any version greater than the specified version | >3.1 : any version greater than 3.1 |
< |
Any version less than the specified version | <3.1 : any version less than 3.1 |
<= |
Any version less than or equal to the specified version | <=3.1 : any version less than or equal to 3.1 |
>= |
Any version greater than or equal to the specified version | >=3.1 : version 3.1 and greater |
== |
Exactly the specified version | ==3.1 : only version 3.1 |
!= |
Any version not equal to the specified version | !=3.1 : any version other than 3.1 |
~= |
Any compatible release. Compatible releases are releases that are within the same major or minor version, assuming the package author is using semantic versioning. | ~=3.1 : version 3.1 or later, but not version 4.0 or later. ~=3.1.2 : version 3.1.2 or later, but not version 3.2.0 or later. |
* |
Can be used at the end of a version number to represent "all" | == 3.1.* : any version that starts with 3.1 . Equivalent to ~=3.1.0 . |
The full specification of supported comparison operators can be found in PEP440.
Error causes
There are three common causes for experiencing a ResolutionImpossible
error.
The cause and possible solution to your error will depend on your individual use case.
1. Your "top level" requirements are too strict
In this scenario, the packages that you have asked pip to install are incompatible, possibly because you have been strict when you specified the package version.
In the example above both packageA
and packageB
have been pinned to use specific versions (packageA==0.44.1b0 packageB==4.3.0
).
To find a version of both packageA
and packageB
that depend on the same version of packageC
, you might consider:
- Loosening the range of packages that you are prepared to install (e.g.
pip install "packageA>0.44.*" "packageB>4.0.0"
) - Asking pip to install any version of
packageA
andpackageB
by removing the version specifiers altogether (e.g.pip install packageA packageB
)
In the second case, pip will automatically find a version of both packageA
and packageB
that depend on the same version of packageC
, installing:
packageA 0.46.0b0
, which depends onpackageC 2.6.1
packageB 4.3.0
which also depends onpackageC 2.6.1
If you want to prioritise one package over another, you can add version specifiers to only the more important package:
pip install packageA==0.44.1b0 packageB
This will result in:
packageA 0.44.1b0
, which depends onpackageC 2.6.1
packageB 4.1.3
which also depends onpackageC 2.6.1
Now that you have resolved the issue, you can repin the compatible package versions as required.
2. A package that you are using has requirements that are too strict
You may find yourself in a situation where a package you are trying to install has specific dependency requirements that create a conflict. This is known as a downstream dependency conflict.
Assuming that you cannot resolve the conflict by loosening the version of the package you require (as above), you can try to fix the issue on the package itself by:
- Requesting that the package maintainers loosen their dependencies
- Forking the package and loosening the dependencies yourself
As a general rule, third party modules (libraries) should strive to reduce the the likelihood of causing dependency conflicts with other libraries by keeping their dependency requirements as loose as possible.
3. All requirements are loose, but a solution does not exist
Sometimes it's simply impossible to find a combination of package versions that do not conflict. Welcome to dependency hell.
In this situation, you can consider:
- Using an alternative package, if that is acceptable for your project (see Awesome Python for similar packages)
- Forking and refactoring one of your dependencies to avoid the conflict
Overriding dependency resolution (force installing)
There is currently no way to override pip's mechanism for resolving dependency conflicts and forcing pip to install an incompatible version of a required package.
If you would like to see this functionality please let the pip team know.
Version 3
Fixing conflicting dependencies
The purpose of this documentation is to provide practical suggestions to pip users who encounter an error where pip cannot install their specified packages due to conflicting dependencies (a ResolutionImpossible
error).
Understanding your error message
When you get a ResolutionImpossible
error, you might see something like this:
pip install packageA==0.44.1b0 packageB==4.3.0
Due to conflicting dependencies pip cannot install packageA and packageB:
- packageA depends on packageC<3.0.0,>=2.4.2
- packageB depends on packageC~=2.3.1
In this example, pip cannot install the packages you have requested, because they each depend on different versions of the same package (packageC
):
packageA
version0.44.1b0
depends on a version ofpackageC
that is less than3.0.0
but greater than or equal to2.4.2
packageB
version4.3.0
depends on apackageC
release that is compatible with version2.3.1
Sometimes these messages are straightforward to read, because they use commonly understood comparison operators to specify the required version (e.g. <
or >
).
However, Python packaging also supports some more complex ways for specifying package versions. Here is the full list supported comparison operators:
Operator | Description | Example |
---|---|---|
> |
Any version greater than the specified version | >3.1 : any version greater than 3.1 |
< |
Any version less than the specified version | <3.1 : any version less than 3.1 |
<= |
Any version less than or equal to the specified version | <=3.1 : any version less than or equal to 3.1 |
>= |
Any version greater than or equal to the specified version | >=3.1 : version 3.1 and greater |
== |
Exactly the specified version | ==3.1 : only version 3.1 |
!= |
Any version not equal to the specified version | !=3.1 : any version other than 3.1 |
~= |
Any compatible release. Compatible releases are releases that are within the same major or minor version, assuming the package author is using semantic versioning. | ~=3.1 : version 3.1 or later, but not version 4.0 or later. ~=3.1.2 : version 3.1.2 or later, but not version 3.2.0 or later. |
* |
Can be used at the end of a version number to represent "all" | == 3.1.* : any version that starts with 3.1 . Equivalent to ~=3.1.0 . |
The full specification of supported comparison operators can be found in PEP440.
Error causes
There are three common causes for experiencing a ResolutionImpossible
error.
The cause and possible solution to your error will depend on your individual use case.
1. Your "top level" requirements are too strict
In this scenario, the packages that you have asked pip to install are incompatible, possibly because you have been strict when you specified the package version.
In the example above both packageA
and packageB
have been pinned to use specific versions (packageA==0.44.1b0 packageB==4.3.0
).
To find a version of both packageA
and packageB
that depend on the same version of packageC
, you might consider:
- Loosening the range of packages that you are prepared to install (e.g.
pip install "packageA>0.44.*" "packageB>4.0.0"
) - Asking pip to install any version of
packageA
andpackageB
by removing the version specifiers altogether (e.g.pip install packageA packageB
)
In the second case, pip will automatically find a version of both packageA
and packageB
that depend on the same version of packageC
, installing:
packageA 0.46.0b0
, which depends onpackageC 2.6.1
packageB 4.3.0
which also depends onpackageC 2.6.1
If you want to prioritise one package over another, you can add version specifiers to only the more important package:
pip install packageA==0.44.1b0 packageB
This will result in:
packageA 0.44.1b0
, which depends onpackageC 2.6.1
packageB 4.1.3
which also depends onpackageC 2.6.1
Now that you have resolved the issue, you can repin the compatible package versions as required.
2. A package that you are using has requirements that are too strict
You may find yourself in a situation where a package you are trying to install has specific dependency requirements that create a conflict. This is known as a downstream dependency conflict.
Assuming that you cannot resolve the conflict by loosening the version of the package you require (as above), you can try to fix the issue on the package itself by:
- Requesting that the package maintainers loosen their dependencies
- Forking the package and loosening the dependencies yourself
As a general rule, third party modules (libraries) should strive to reduce the the likelihood of causing dependency conflicts with other libraries by keeping their dependency requirements as loose as possible.
3. All requirements are loose, but a solution does not exist
Sometimes it's simply impossible to find a combination of package versions that do not conflict. Welcome to dependency hell.
In this situation, you can consider using an alternative package, if that is acceptable for your project. Seee Awesome Python for similar packages.
Getting help
If none of the suggestions above work for you, we recommend that you ask for help on:
See "How do I ask a good question?" for tips on asking for help.
Unfortunately, the pip team cannot provide support for individual conflict errors. Please only open a ticket on the pip issue tracker if you believe that your problem has exposed a bug in pip.
Version 4
Fixing conflicting dependencies (v. 17 June)
The purpose of this documentation is to provide practical suggestions to pip users who encounter an error where pip cannot install their specified packages due to conflicting dependencies (a ResolutionImpossible
error).
Understanding your error message
When you get a ResolutionImpossible
error, you might see something like this:
pip install packageA==0.44.1 packageB==4.3.0
Due to conflicting dependencies pip cannot install packageA and packageB:
- packageA depends on packageC<3.0.0,>=2.4.2
- packageB depends on packageC==2.3.1
In this example, pip cannot install the packages you have requested, because they each depend on different versions of the same package (packageC
):
packageA
version0.44.1
depends on a version ofpackageC
that is less than3.0.0
but greater than or equal to2.4.2
packageB
version4.3.0
depends on version2.3.1
ofpackageC
Sometimes these messages are straightforward to read, because they use commonly understood comparison operators to specify the required version (e.g. <
or >
).
However, Python packaging also supports some more complex ways for specifying package versions (e.g. ~=
or *
).
View the full list supported comparison operators
Operator | Description | Example |
---|---|---|
> |
Any version greater than the specified version | >3.1 : any version greater than 3.1 |
< |
Any version less than the specified version | <3.1 : any version less than 3.1 |
<= |
Any version less than or equal to the specified version | <=3.1 : any version less than or equal to 3.1 |
>= |
Any version greater than or equal to the specified version | >=3.1 : version 3.1 and greater |
== |
Exactly the specified version | ==3.1 : only version 3.1 |
!= |
Any version not equal to the specified version | !=3.1 : any version other than 3.1 |
~= |
Any compatible release. Compatible releases are releases that are within the same major or minor version, assuming the package author is using semantic versioning. | ~=3.1 : version 3.1 or later, but not version 4.0 or later. ~=3.1.2 : version 3.1.2 or later, but not version 3.2.0 or later. |
* |
Can be used at the end of a version number to represent "all" | == 3.1.* : any version that starts with 3.1 . Equivalent to ~=3.1.0 . |
The detailed specification of supported comparison operators can be found in PEP440.
Determining the origin of your conflict
In order to resolve your conflict, it's useful to understand that conflicts can occur between your "top level requirements" - packages you told pip to install - and "downstream dependencies" - packages required by your top level requirements.
1. Conflicts in your downstream dependencies
As in our example above, you may experience conflicts between your downstream dependencies (also known as "transitive dependencies"). This can happen at a high level:
Or deeper within your dependency tree:
2. Conflicts between your top level requirements and your downstream dependencies
Sometimes, a top level requirement is also a downstream dependency of one of your other packages:
To trace the origin of your conflict, you can run pip in verbose mode
Possible solutions
The solution to your error will depend on your individual use case. Here are some things to try:
1. Audit your top level requirements
As a first step it is useful to audit your project and remove any unneccessary or out of date requirements. Removing these can significantly reduce the complexity of your dependency tree, thereby reducing opportunities for conflicts to occur.
2. Loosen your top level requirements
Sometimes the packages that you have asked pip to install are incompatible because you have been too strict when you specified the package version.
In our first example both packageA
and packageB
have been pinned to use specific versions (packageA==0.44.1b0 packageB==4.3.0
).
To find a version of both packageA
and packageB
that depend on the same version of packageC
, you might consider:
- Loosening the range of packages that you are prepared to install (e.g.
pip install "packageA>0.44.*" "packageB>4.0.0"
) - Asking pip to install any version of
packageA
andpackageB
by removing the version specifiers altogether (e.g.pip install packageA packageB
)
In the second case, pip will automatically find a version of both packageA
and packageB
that depend on the same version of packageC
, installing:
packageA 0.46.0b0
, which depends onpackageC 2.6.1
packageB 4.3.0
which also depends onpackageC 2.6.1
If you want to prioritise one package over another, you can add version specifiers to only the more important package:
pip install packageA==0.44.1b0 packageB
This will result in:
packageA 0.44.1b0
, which depends onpackageC 2.6.1
packageB 4.1.3
which also depends onpackageC 2.6.1
Now that you have resolved the issue, you can repin the compatible package versions as required.
3. Loosen the requirements of your downstream dependencies
Assuming that you cannot resolve the conflict by loosening the version of the package you require (as above), you can try to fix the issue on your downstream dependency by:
- Requesting that the package maintainers loosen their dependencies
- Forking the package and loosening the dependencies yourself
Warning: If you choose to fork the package yourself, you are opting out of any support provided by the package maintainers. Proceed at your own risk!
4. All requirements are loose, but a solution does not exist
Sometimes it's simply impossible to find a combination of package versions that do not conflict. Welcome to dependency hell.
In this situation, you could consider:
- Using an alternative package, if that is acceptable for your project. See Awesome Python for similar packages.
- Refactoring your project to reduce the number of dependencies (for example, by breaking up a monolithic code base into smaller pieces)
Getting help
If none of the suggestions above work for you, we recommend that you ask for help on:
See "How do I ask a good question?" for tips on asking for help.
Unfortunately, the pip team cannot provide support for individual dependency conflict errors. Please only open a ticket on the pip issue tracker if you believe that your problem has exposed a bug in pip.