Try installing matplotlib through apt-get.