9

I can't seem to get pip to install psycopg2 in a latest project virtualenv (on macOS seirra with brew installed python) The error is:

creating build/temp.macosx-10.11-x86_64-3.5/psycopg
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/psycopgmodule.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/green.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/green.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/pqpath.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/pqpath.o
    psycopg/pqpath.c:198:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
                    PQstatus(conn->pgconn) : PQresultStatus(*pgres)));
                    ^~~~~~~~~~~~~~~~~~~~~~
    psycopg/pqpath.c:666:14: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        if (size >= sizeof(query)) {
            ~~~~ ^  ~~~~~~~~~~~~~
    psycopg/pqpath.c:731:14: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        if (size >= sizeof(query)) {
            ~~~~ ^  ~~~~~~~~~~~~~
    psycopg/pqpath.c:1628:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
                    PQstatus(curs->conn->pgconn) : PQresultStatus(curs->pgres)));
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    4 warnings generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/utils.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/utils.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/bytes_format.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/bytes_format.o
    In file included from psycopg/bytes_format.c:81:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/connection_int.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/connection_int.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/connection_type.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/connection_type.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/cursor_int.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/cursor_int.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/cursor_type.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/cursor_type.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/diagnostics_type.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/diagnostics_type.o
    In file included from psycopg/diagnostics_type.c:27:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/error_type.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/error_type.o
    In file included from psycopg/error_type.c:27:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/lobject_int.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/lobject_int.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/lobject_type.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/lobject_type.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/notify_type.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/notify_type.o
    In file included from psycopg/notify_type.c:27:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/xid_type.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/xid_type.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_asis.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_asis.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_binary.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_binary.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_datetime.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_datetime.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_list.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_list.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_pboolean.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pboolean.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_pdecimal.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pdecimal.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_pint.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pint.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_pfloat.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pfloat.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/adapter_qstring.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_qstring.o
    psycopg/adapter_qstring.c:98:14: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        if (qlen > (size_t) PY_SSIZE_T_MAX) {
            ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/microprotocols.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/microprotocols.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/microprotocols_proto.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/microprotocols_proto.o
    In file included from psycopg/microprotocols_proto.c:27:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090500 -DHAVE_LO64=1 -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I. -I/usr/local/Cellar/postgresql/9.5.0/include -I/usr/local/Cellar/postgresql/9.5.0/include/server -c psycopg/typecast.c -o build/temp.macosx-10.11-x86_64-3.5/psycopg/typecast.o
    psycopg/typecast.c:494:5: warning: incompatible pointer types initializing 'PyAsyncMethods *' with an expression of type 'int (PyObject *, PyObject *)' (aka 'int (struct _object *, struct _object *)') [-Wincompatible-pointer-types]
        typecast_cmp, /*tp_compare*/
        ^~~~~~~~~~~~
    1 warning generated.
    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.11-x86_64-3.5/psycopg/psycopgmodule.o build/temp.macosx-10.11-x86_64-3.5/psycopg/green.o build/temp.macosx-10.11-x86_64-3.5/psycopg/pqpath.o build/temp.macosx-10.11-x86_64-3.5/psycopg/utils.o build/temp.macosx-10.11-x86_64-3.5/psycopg/bytes_format.o build/temp.macosx-10.11-x86_64-3.5/psycopg/connection_int.o build/temp.macosx-10.11-x86_64-3.5/psycopg/connection_type.o build/temp.macosx-10.11-x86_64-3.5/psycopg/cursor_int.o build/temp.macosx-10.11-x86_64-3.5/psycopg/cursor_type.o build/temp.macosx-10.11-x86_64-3.5/psycopg/diagnostics_type.o build/temp.macosx-10.11-x86_64-3.5/psycopg/error_type.o build/temp.macosx-10.11-x86_64-3.5/psycopg/lobject_int.o build/temp.macosx-10.11-x86_64-3.5/psycopg/lobject_type.o build/temp.macosx-10.11-x86_64-3.5/psycopg/notify_type.o build/temp.macosx-10.11-x86_64-3.5/psycopg/xid_type.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_asis.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_binary.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_datetime.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_list.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pboolean.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pdecimal.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pint.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_pfloat.o build/temp.macosx-10.11-x86_64-3.5/psycopg/adapter_qstring.o build/temp.macosx-10.11-x86_64-3.5/psycopg/microprotocols.o build/temp.macosx-10.11-x86_64-3.5/psycopg/microprotocols_proto.o build/temp.macosx-10.11-x86_64-3.5/psycopg/typecast.o -L/usr/local/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.11-x86_64-3.5/psycopg2/_psycopg.cpython-35m-darwin.so
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/Users/Barclay/.virtualenvs/switcher52/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/bg/khxkyq75109cbmxt7n1vb0qc0000gn/T/pip-build-gll0mv8c/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/bg/khxkyq75109cbmxt7n1vb0qc0000gn/T/pip-u44_rti6-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/Barclay/.virtualenvs/switcher52/bin/../include/site/python3.5/psycopg2" failed with error code 1 in /private/var/folders/bg/khxkyq75109cbmxt7n1vb0qc0000gn/T/pip-build-gll0mv8c/psycopg2/
Yunti
  • 6,761
  • 12
  • 61
  • 106

2 Answers2

9

The warning says nothing, the problem is: ld: library not found for -lssl. which means that you should install openssl first. on homebrew this could be as easy as brew install openssl

Christian Schmitt
  • 837
  • 16
  • 47
  • 5
    Hrm. I must have a far more dastardly issue, wherein this is already installed and so maybe a spurious error. – Metagrapher Dec 05 '16 at 21:10
  • 1
    I tried this and it didn't work, however updating to psycopg2 2.9.2 fixed it (not sure if this is related to Apple M1 since it came out after this question was originally asked) – Andre OBrien Nov 28 '21 at 22:36
3

Error is here:

ld: library not found for -lssl

So you probably have to install ssl library.

Mateusz Soltysik
  • 815
  • 9
  • 16