title: How to resolve the dependency hell in order to install matplotlib?
body: <p>I want to install <code>matplotlib</code> via <code>pip</code>. However, I run into circular issues and at certain point I got stuck. Running <code>pip</code> in the terminal produces:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/bin/pip", line 5, in &lt;module&gt;
      from pkg_resources import load_entry_point
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3080, in &lt;module&gt;
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3066, in _call_aside
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3093, in _initialize_master_working_set
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 651, in _build_master
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 952, in require
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 839, in resolve
  pkg_resources.DistributionNotFound: The 'pip==1.5.4' distribution was not found and is required by the application
  </code></pre>
  
  <p>I tried to fix this with <code>easy_install</code>, but it produced the following error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/bin/easy_install", line 5, in &lt;module&gt;
      from pkg_resources import load_entry_point
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3080, in &lt;module&gt;
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3066, in _call_aside
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3093, in _initialize_master_working_set
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 653, in _build_master
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 666, in _build_from_requirements
    File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 839, in resolve
  pkg_resources.DistributionNotFound: The 'setuptools==3.3' distribution was not found and is required by the application
  </code></pre>
  
  <p>Running <code>sudo apt-get install python-setuptools</code> says that I already have the newest version.</p>
  
  <p>My OS is <code>Ubuntu 14.04</code>. I have tried many different approaches to fix the issue and probably ended up doing even further harm. I don't recall everything I did and how I ended up at this stage, so unfortunately cannot give further info. </p>
  
  <p>My objective is to have <code>matplotlib</code> installed in the end and have a stable state of all my <code>python</code> related libraries. Any solution will work, so I don't mind reinstalling everything or whatever would fix the issue.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Running <code>sudo apt-get build-dep python-matplotlib</code> produces</p>
  
  <pre><code>Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  Picking 'matplotlib' as source package instead of 'python-matplotlib'
  E: Unable to find a source package for matplotlib
  </code></pre>
  
  <p>Whereas <code>sudo apt-get install python-matplotlib</code> produces</p>
  
  <pre><code>Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  python-matplotlib is already the newest version.
  0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
  </code></pre>
  
  <p>However, <code>matplotlib</code> is still not found from <code>python</code>.</p>