سؤال

I'm having some trouble installing psycopg2 into a virtualenv. Here is the output for pip install psycopg2.

Note 1: I checked a lot of StackOverflow answers and i installed all that *-dev packages suggested. Some hint here?

Note 2: I get same output from python setup.py install on source.

Downloading/unpacking psycopg2
  Downloading psycopg2-2.5.1.tar.gz (684kB): 684kB downloaded
  Running setup.py egg_info for package psycopg2

Installing collected packages: psycopg2
  Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.1 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x09010A -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-i686-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    In file included from /usr/include/string.h:642:0,
                     from /usr/include/python2.7/Python.h:38,
                     from ./psycopg/psycopg.h:30,
                     from psycopg/psycopgmodule.c:27:
    /usr/include/i386-linux-gnu/bits/string3.h: In function ‘memcpy’:
    /usr/include/i386-linux-gnu/bits/string3.h:52:3: internal compiler error: Segmentation fault
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
    Preprocessed source stored into /tmp/ccANjg96.out file, please attach this to your bugreport.
    error: command 'gcc' failed with exit status 1
    Complete output from command /webapps/sysacad_wrapper/bin/python -c "import setuptools;__file__='/webapps/sysacad_wrapper/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ixowrn-record/install-record.txt --single-version-externally-managed --install-headers /webapps/sysacad_wrapper/include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.linux-i686-2.7

creating build/lib.linux-i686-2.7/psycopg2

copying lib/tz.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/psycopg1.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/_json.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/extras.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/extensions.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/pool.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/errorcodes.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/_range.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/__init__.py -> build/lib.linux-i686-2.7/psycopg2

creating build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_module.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_types_extras.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_lobject.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_copy.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_with.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_cancel.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_connection.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_quote.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/dbapi20.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/testconfig.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_bugX000.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_extras_dictcursor.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/testutils.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_transaction.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_bug_gc.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_dates.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_async.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/dbapi20_tpc.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_notify.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_green.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_types_basic.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_cursor.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/__init__.py -> build/lib.linux-i686-2.7/psycopg2/tests

running build_ext

building 'psycopg2._psycopg' extension

creating build/temp.linux-i686-2.7

creating build/temp.linux-i686-2.7/psycopg

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.1 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x09010A -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-i686-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement

In file included from /usr/include/string.h:642:0,

                 from /usr/include/python2.7/Python.h:38,

                 from ./psycopg/psycopg.h:30,

                 from psycopg/psycopgmodule.c:27:

/usr/include/i386-linux-gnu/bits/string3.h: In function ‘memcpy’:

/usr/include/i386-linux-gnu/bits/string3.h:52:3: internal compiler error: Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

Preprocessed source stored into /tmp/ccANjg96.out file, please attach this to your bugreport.

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /webapps/sysacad_wrapper/bin/python -c "import setuptools;__file__='/webapps/sysacad_wrapper/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ixowrn-record/install-record.txt --single-version-externally-managed --install-headers /webapps/sysacad_wrapper/include/site/python2.7 failed with error code 1 in /webapps/sysacad_wrapper/build/psycopg2
Traceback (most recent call last):
  File "/webapps/sysacad_wrapper/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/webapps/sysacad_wrapper/local/lib/python2.7/site-packages/pip/__init__.py", line 148, in main
    return command.main(args[1:], options)
  File "/webapps/sysacad_wrapper/local/lib/python2.7/site-packages/pip/basecommand.py", line 169, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 60: ordinal not in range(128)
هل كانت مفيدة؟

المحلول

I've already solved it. Upgrading gcc to 4.8.2 did the work. Thanks anyway.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top