Search code examples
pythonwindowsdistutils

Do I need to uninstall Python package before upgrading to newer version?


I'm running Python on Windows and usually install packages using pre-built binaries. When I upgrade packages (ex. from matplotlib-1.0.0 to matplotlib-1.1.1) do I need to uninstall the earlier version first?

I did a test upgrading matplotlib without uninstalling the previous version and everything seems to be okay. matplotlib.__version__ shows '1.1.1'. So did distutils just overwrite files, potentially leaving old files cluttering my site-packages folder? Or did the installer look for previous installations, remove those first, and then install the new version?


Solution

  • If you are using pip, you can do pip install package --upgrade, but you'll see that essentially it's the same as uninstall followed by a fresh install.