Can I force pip to reinstall the current version?

1.2K    Asked by AswiniLobo in Devops , Asked on Jun 3, 2021

I've come across situations where a current version of a package seems not to be working and requires reinstallation. But pip install -U won't touch a package that is already up-to-date. I see how to force a reinstallation by first uninstalling (with pip uninstall) and then installing, but is there a way to simply force an "update" to a nominally current version in a single step?

Answered by Andrea Bailey

Yes, you can force reinstall pip the current version below is the command for the same:-

    pip install --upgrade --force-reinstall 

When you are upgrading the pip then you should reinstall all packages even if they are already updated. In that case, you should ignore the installed packages (reinstalling instead). However, you can use the following command to ignore the installed packages.

pip install -I 
pip install --ignore-installed


Your Answer

Interviews

Parent Categories