Search code examples
pythonbashubuntupip

How to show the dependency problem in the existing python environment


I installed the python packages on Ubuntu by the following command:

# pip install --upgrade -r r.txt

Here is the console output:

Installing collected packages: protobuf

ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
apache-beam 2.53.0 requires packaging>=22.0, but you'll have packaging 20.9 which is incompatible.
ortools 9.8.3296 requires absl-py>=2.0.0, but you'll have absl-py 1.4.0 which is incompatible.
ortools 9.8.3296 requires pandas>=2.0.0, but you'll have pandas 1.5.3 which is incompatible.

Successfully installed protobuf-4.25.1
#

After closing the console, I want to reopen the terminal to check what dependency problem is in my system.

Here is the expected output:

# pip what_command_to_show_the_problem

ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
apache-beam 2.53.0 requires packaging>=22.0, but you'll have packaging 20.9 which is incompatible.
ortools 9.8.3296 requires absl-py>=2.0.0, but you'll have absl-py 1.4.0 which is incompatible.
ortools 9.8.3296 requires pandas>=2.0.0, but you'll have pandas 1.5.3 which is incompatible.

What command can be used to show the same dependency problem existed in the system?


Solution

  • The command is pip check

    See the docs:

    Verify installed packages have compatible dependencies.

    If you want to check a virtual environment don't forget to activate it or run its python/pip instead of the base ones:

    path/to/venv/bin/python -m pip check