Install required packages if they are missing