Search code examples
pythoninstallationpippackage-management

What happens if we cancel "pip install" in the middle of installation?


When installing packages using pip (e.g., pip install -r requirements.txt), what happens if we cancel the process in the middle of the installation? Does pip automatically rollback to the state before the installation started?


Solution

  • If the process of installing packages using pip (e.g. via the command pip install -r requirements.txt) is interrupted in the middle of execution, pip does not automatically roll back to the state before the installation began.

    Already installed packages will remain in place: if any package was installed before the interruption, it will remain installed.

    So if an error occurred or you manually interrupted the installation, just enter the command again.

    pip install -r requirements.txt  # pip will only attempt to install packages that are not fully installed