title: ImportError: No module named pkg_resources when running pip on Amazon EC2
body: <p>I'm trying to set up an EC2 instance with django but I'm having issues installing anything.  I ran <code>sudo apt-get update</code> and <code>upgrade -y</code>. But when I try to run pip  which it claims is installed I get this: </p>
  
  <pre><code>ubuntu@ip-172-31-62-51:/home$ pip
  Traceback (most recent call last):
    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>When I try <code>sudo apt-get upgrade -y</code> I get this:</p>
  
  <pre><code>Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  The following packages have been kept back:
    linux-headers-virtual linux-image-virtual linux-virtual
  0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
  2 not fully installed or removed.
  After this operation, 0 B of additional disk space will be used.
  Setting up python-pip (1.0-1build1) ...
  Traceback (most recent call last):
    File "/usr/bin/pycompile", line 36, in &lt;module&gt;
      from debpython.version import SUPPORTED, debsorted, vrepr, \
    File "/usr/share/python/debpython/version.py", line 24, in &lt;module&gt;
      from ConfigParser import SafeConfigParser
  ImportError: No module named ConfigParser
  dpkg: error processing python-pip (--configure):
   subprocess installed post-installation script returned error exit status 1
  Setting up python-twisted-names (11.1.0-1) ...
  Traceback (most recent call last):
    File "/usr/bin/pycompile", line 36, in &lt;module&gt;
      from debpython.version import SUPPORTED, debsorted, vrepr, \
    File "/usr/share/python/debpython/version.py", line 24, in &lt;module&gt;
      from ConfigParser import SafeConfigParser
  ImportError: No module named ConfigParser
  dpkg: error processing python-twisted-names (--configure):
   subprocess installed post-installation script returned error exit status 1
  Errors were encountered while processing:
   python-pip
   python-twisted-names
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  </code></pre>
  
  <p>I actually get this error anything I try to use apt-get for anything.</p>
  
  <p>Also anytime I try to actually use pip I get this:</p>
  
  <pre><code>ubuntu@ip-172-31-62-51:/home$ sudo pip install virtualenv
  Traceback (most recent call last):
    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>When I try to use apt-add-repository ppa:chris-lea/nodejs (since <code>sudo apt-get install nodejs</code> doesn't work) I get:</p>
  
  <pre><code>ubuntu@ip-172-31-62-51:/home$ sudo apt-add-repository ppa:chris-lea/nodejs
    File "/usr/bin/apt-add-repository", line 37
      print _("The %s named '%s' has no PPA named '%s'"
            ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>I had it work before, but I was having the same problems with pip and such, I tried a fresh instance using Ubuntu Server 12 rather than 14, but I'm having same problems.  Although on 14 I couldnt get nginx to install and on 12 I could.  I was able to install ruby, as well as ruby gems like sass/scss.  I got node installed without the new repo.  npm won't install via apt-get though, same error as before.  Why is this happening?  I can't even get virtualenv installed, I can't use this for development as it doesn't even have all the items I need for the production product.  Is ubuntu 12 the problem (although 14 had issues too).  Should I switch to another AMI?</p>
  
  <p>Any idea why things aren't working right?</p>
  
  <p>Thanks</p>
  
  <p>EDIT:  I get the same error if i try to remove pip with apt.</p>