Helper function to ensure a package is installed