only delete matplotlib from namespace when successfully imported