title: Error trying to install Postgres for python (psycopg2)
body: <p>I tried to install psycopg2 to my environment, but I get the following error:</p>
  
  <pre><code>(venv)avlahop@apostolos-laptop:~/development/django/rhombus-dental$ sudo pip install psycopg2
  Downloading/unpacking psycopg2,
  Downloading psycopg2-2.5.2.tar.gz (685kB): 685kB downloaded
  Running setup.py egg_info for package psycopg2
  
  Installing collected packages: psycopg2
    Running setup.py install for psycopg2
      building 'psycopg2._psycopg' extension
      x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x09010D -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.1/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
      In file included from psycopg/psycopgmodule.c:27:0:
      ./psycopg/psycopg.h:30:20: fatal error: Python.h: Δεν υπάρχει τέτοιο αρχείο ή κατάλογος
       #include &lt;Python.h&gt;
                      ^
      compilation terminated.
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-SgfQCA-record/install-record.txt --single-version-externally-managed:
  running install
  
  running build
  
  running build_py
  
  creating build
  
  creating build/lib.linux-x86_64-2.7
  
  creating build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/pool.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/errorcodes.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/__init__.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/_json.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/_range.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/extensions.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/psycopg1.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/tz.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  copying lib/extras.py -&gt; build/lib.linux-x86_64-2.7/psycopg2
  
  creating build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/testconfig.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copyng tests/test_bug_gc.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_dates.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_copy.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_cancel.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_bugX000.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_extras_dictcursor.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_psycopg2_dbapi20.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_types_basic.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_async.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_lobject.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_cursor.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_with.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/__init__.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_types_extras.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/testutils.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_notify.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_green.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_quote.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_connection.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_transaction.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/dbapi20.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/test_module.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  copying tests/dbapi20_tpc.py -&gt; build/lib.linux-x86_64-2.7/psycopg2/tests
  
  running build_ext
  
  building 'psycopg2._psycopg' extension
  
  creating build/temp.linux-x86_64-2.7
  
  creating build/temp.linux-x86_64-2.7/psycopg
  
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x09010D -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.1/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
  
  In file included from psycopg/psycopgmodule.c:27:0:
  
  ./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory
   #include &lt;Python.h&gt;
  
                  ^
  
  compilation terminated.
  
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Cleaning up...
  Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-SgfQCA-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/psycopg2
  Traceback (most recent call last):
    File "/usr/bin/pip", line 9, in &lt;module&gt;
      load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
    File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 148, in main
      return command.main(args[1:], options)
    File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 169, in main
      text = '\n'.join(complete_log)
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 54: ordinal not in range(128)
  </code></pre>
  
  <p>I also get errors trying to install gunicorn. I followed <a href="https://devcenter.heroku.com/articles/getting-started-with-python" rel="noreferrer">this</a> example here but nothing. My virtual environment was created using the <code>--no-site-packages</code>flag. I use ubuntu 13.10 and greek environment. Maybe it's that?</p>