Remove modules and libraries that are duplicated in the profile.