title: pip install psycopg2==2.6 giving error Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-f6rRmm/psycopg2/
body: <p>My projects is running postgreSQL and after I upgraded my system to ubuntu 16.04, and cloned the project again, I am not able to install the particular package. </p>
  
  <p>I have also tried to purge postgresql and psycopg2 but am not able to install it</p>
  
  <pre><code>(temp) hellrazor@hellrazor-desktop:~/workspace/te___ave/backend/te___ave$ pip install psycopg2==2.6 &gt; ERROR.txt
  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-f6rRmm/psycopg2/
  (temp) hellrazor@hellrazor-desktop:~/workspace/te___ave/backend/te___ave$ 
  </code></pre>
  
  <p>This is the error I am getting</p>
  
  <pre><code>Collecting psycopg2==2.6
    Using cached psycopg2-2.6.tar.gz
      Complete output from command python setup.py egg_info:
      running egg_info
      creating pip-egg-info/psycopg2.egg-info
      writing pip-egg-info/psycopg2.egg-info/PKG-INFO
      writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
      writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
      writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
      Error: pg_config executable not found.
  
      Please add the directory containing pg_config to the PATH
      or specify the full executable path with the option:
  
          python setup.py build_ext --pg-config /path/to/pg_config build ...
  
      or with the pg_config option in 'setup.cfg'.
  
      ----------------------------------------
  </code></pre>
  
  <p>I did all the steps written in <a href="https://help.ubuntu.com/community/PostgreSQL#Client_Installation" rel="nofollow noreferrer">https://help.ubuntu.com/community/PostgreSQL#Client_Installation</a></p>
  
  <p>Also in some answer in <a href="https://stackoverflow.com/questions/11618898/pg-config-executable-not-found">pg_config executable not found</a> I saw that I needed to add <code>sudo apt-get install libpq-dev python-dev</code></p>
  
  <p>but it gave this output</p>
  
  <pre><code>(temp) hellrazor@hellrazor-desktop:~/workspace/teamwave/backend/teamwave$ sudo apt-get install libpq-dev python-dev
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  python-dev is already the newest version (2.7.11-1).
  Some packages could not be installed. This may mean that you have
  requested an impossible situation or if you are using the unstable
  distribution that some required packages have not yet been created
  or been moved out of Incoming.
  The following information may help to resolve the situation:
  
  The following packages have unmet dependencies:
   libpq-dev : Depends: libpq5 (= 9.5.10-0ubuntu0.16.04) but 10.1-1.pgdg16.04+1 is to be installed
  E: Unable to correct problems, you have held broken packages.
  </code></pre>
  
  <p>I am trying to find how to resolve the error but not getting any leads now. </p>