Check for preinstalled packages. Fixes #1795.