Errors during install, e.g. due to dependency issues, that happened while a "Requirement already installed" message was present in the output as well, were wrongly read as a "reinstall needed" case if there was no failure line present for some reason. The logic has now been adjusted so that a reinstall will only be triggered if there was no `Error:` line in the output. A test case has been added as well. Closes #4703