title: ImportError: No module named pkg_resources on installing matplotlib
body: <p>This is on CentOs 6.6. I am trying to set up a scientific python environment. I want to avoid Anaconda. When trying to install matplotlib, I get "ImportError: No module named pkg_resources". Full install history:</p>
  
  <pre><code>sudo yum install gcc-c++.x86_64
  sudo yum install gcc
  sudo yum install atlas atlas-devel lapack-devel blas-devel
  sudo yum install python-devel
  sudo pip install numpy
  sudo pip install scipy
  sudo pip install pandas
  sudo pip install matplotlib
  </code></pre>
  
  <p>At the last step, I get the message </p>
  
  <pre><code>Complete output from command python setup.py egg_info:
  The required version of distribute (&gt;=0.6.28) is not available,
  and can't be installed while this script is running. Please
  install a more recent version first, using
  'easy_install -U distribute'.
  </code></pre>
  
  <p>Then I do </p>
  
  <pre><code>sudo pip install --upgrade distribute
  </code></pre>
  
  <p>which installs <code>distribute-0.7.3</code>, <code>setuptools-18.0.1</code>. Then:</p>
  
  <pre><code>sudo pip install matplotlib
  </code></pre>
  
  <p>which results in:</p>
  
  <pre><code>File "/usr/bin/pip", line 5, in &lt;module&gt;
    from pkg_resources import load_entry_point
  ImportError: No module named pkg_resources
  </code></pre>
  
  <p>Any ideas?</p>
  
  <h3>Update</h3>
  
  <p>After the above steps, <code>setuptools</code> and <code>pip</code> are broken in this installation. From a python shell, doing <code>help()</code> followed by <code>modules</code> does not list <code>setuptools</code>. A search in the filesystem for <code>setuptools</code> directories reveals:</p>
  
  <pre><code>/usr/lib/python2.6/site-packages/setuptools-18.0.1.dist-info/
  </code></pre>
  
  <p>while the <code>setuptools.pth</code> file in <code>/usr/lib/python2.6/site-packages/</code> contains a pointer to the non-existent <code>./setuptools-0.6c11-py2.6.egg-info</code>.</p>
  
  <p>At the same time, there is a directory </p>
  
  <pre><code>/usr/share/doc/python-setuptools-0.6.10/
  </code></pre>
  
  <p>After all this, pip no longer works. </p>