modified the way to check if matplotlib is installed