3

I'm setting up my new server (ubuntu 16.04.01) and i need to setup my sistem with postgres (9.3)+virtualenv+python+django(1.6)+nginx ecc..

I have already set-up the same sistem, 2 years ago, on ubuntu 14.04 with no problem, but now on new lts, i cant'install psycopg2.

When from virtualenv i try to execute pip install psycopg2 i receve this error message:

(gips) gips@gips-locale:~/gips/virtualenv/gestogips$ pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.6.2.tar.gz
Building wheels for collected packages: psycopg2
  Running setup.py bdist_wheel for psycopg2 ... error
  Complete output from command /home/gips/gips/virtualenv/gips/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-PF24T2/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp9wlqN9pip-wheel- --python-tag cp27:
  running bdist_wheel
  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/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/pool.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/errorcodes.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/extensions.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/_range.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/psycopg1.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/tz.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/_json.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/extras.py -> build/lib.linux-x86_64-2.7/psycopg2
  creating build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/testutils.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_lobject.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_types_basic.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_copy.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_transaction.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_bug_gc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_connection.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_green.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_bugX000.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_module.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_dates.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/testconfig.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_with.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_types_extras.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_cursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_cancel.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_errcodes.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_async.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_quote.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_notify.py -> 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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 
-DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x09030E -DHAVE_LO64=1 -I/usr/include/python2.7 -I. 
-I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c 
-o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement

  unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
  Running setup.py install for psycopg2 ... error
    Complete output from command /home/gips/gips/virtualenv/gips/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-PF24T2/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ORPyfs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/gips/gips/virtualenv/gips/include/site/python2.7/psycopg2:
    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/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/pool.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/errorcodes.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/extensions.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/_range.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/psycopg1.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/tz.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/_json.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/extras.py -> build/lib.linux-x86_64-2.7/psycopg2
    creating build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/testutils.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_lobject.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_types_basic.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_copy.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_transaction.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_bug_gc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_connection.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_green.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_bugX000.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_module.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_dates.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/testconfig.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_with.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_types_extras.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_cursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_cancel.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_errcodes.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_async.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_quote.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_notify.py -> 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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 
-DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x09030E -DHAVE_LO64=1 -I/usr/include/python2.7 -I. 
-I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c 
-o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/gips/gips/virtualenv/gips/bin/python2 -u -c "import setuptools, 
tokenize;__file__='/tmp/pip-build-PF24T2/psycopg2/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record /tmp/pip-ORPyfs-record/install-record.txt --single-version-externally-managed --compile 
--install-headers /home/gips/gips/virtualenv/gips/include/site/python2.7/psycopg2" 
failed with error code 1 in /tmp/pip-build-PF24T2/psycopg2/

any ideas? i have read a couple of similar post that suggest to run

sudo apt-get install libpq-dev python-dev

but i have done it with no results..still have same error

P. Leli
  • 33
  • 1
  • 4
  • Do you have gcc installed? Looks like it cant execute the gcc command to compile the required package. – LinuxBill Sep 01 '16 at 14:04
  • Possible duplicate of [Debugging the error "gcc: error: x86\_64-linux-gnu-gcc: No such file or directory"](http://stackoverflow.com/questions/22571848/debugging-the-error-gcc-error-x86-64-linux-gnu-gcc-no-such-file-or-directory) – maharshi Sep 01 '16 at 14:06
  • With the sudo on my comment above it worked! But i don't know wich library was the correct one..;) – P. Leli Sep 01 '16 at 14:06
  • ganonychical leave some packages(yesterday throw error on fresh install). GCC not pythonic `C` library. You want os C compiler as python C compiler. Need some package (python) for using OS level C compiler. I forget package name but `sympy` or `numpy` include related module. – dsgdfg Sep 01 '16 at 14:17
  • It's better to delete this question? Sorry for wasting your time and thank you anyway. – P. Leli Sep 01 '16 at 14:17
  • it's not a bad question... @P.Leli – dsgdfg Sep 01 '16 at 14:18

0 Answers0