0

I am having this error:

 cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=110003 -DHAVE_LO64=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/11.3/include -I/usr/local/Cellar/postgresql/11.3/include/server -c psycopg/typecast.c -o build/temp.macosx-10.14-intel-2.7/psycopg/typecast.o
    cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.14-intel-2.7/psycopg/psycopgmodule.o build/temp.macosx-10.14-intel-2.7/psycopg/green.o build/temp.macosx-10.14-intel-2.7/psycopg/pqpath.o build/temp.macosx-10.14-intel-2.7/psycopg/utils.o build/temp.macosx-10.14-intel-2.7/psycopg/bytes_format.o build/temp.macosx-10.14-intel-2.7/psycopg/libpq_support.o build/temp.macosx-10.14-intel-2.7/psycopg/win32_support.o build/temp.macosx-10.14-intel-2.7/psycopg/solaris_support.o build/temp.macosx-10.14-intel-2.7/psycopg/connection_int.o build/temp.macosx-10.14-intel-2.7/psycopg/connection_type.o build/temp.macosx-10.14-intel-2.7/psycopg/cursor_int.o build/temp.macosx-10.14-intel-2.7/psycopg/cursor_type.o build/temp.macosx-10.14-intel-2.7/psycopg/column_type.o build/temp.macosx-10.14-intel-2.7/psycopg/replication_connection_type.o build/temp.macosx-10.14-intel-2.7/psycopg/replication_cursor_type.o build/temp.macosx-10.14-intel-2.7/psycopg/replication_message_type.o build/temp.macosx-10.14-intel-2.7/psycopg/diagnostics_type.o build/temp.macosx-10.14-intel-2.7/psycopg/error_type.o build/temp.macosx-10.14-intel-2.7/psycopg/conninfo_type.o build/temp.macosx-10.14-intel-2.7/psycopg/lobject_int.o build/temp.macosx-10.14-intel-2.7/psycopg/lobject_type.o build/temp.macosx-10.14-intel-2.7/psycopg/notify_type.o build/temp.macosx-10.14-intel-2.7/psycopg/xid_type.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_asis.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_binary.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_datetime.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_list.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pboolean.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pdecimal.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pint.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pfloat.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_qstring.o build/temp.macosx-10.14-intel-2.7/psycopg/microprotocols.o build/temp.macosx-10.14-intel-2.7/psycopg/microprotocols_proto.o build/temp.macosx-10.14-intel-2.7/psycopg/typecast.o -L/usr/local/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7/psycopg2/_psycopg.so
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'cc' failed with exit status 1
    ----------------------------------------
ERROR: Command "[path]/venv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/8n/zd44l25535b8kfhz1cfdx7980000gn/T/pip-install-nVe8Y3/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/8n/zd44l25535b8kfhz1cfdx7980000gn/T/pip-record-NVUuR_/install-record.txt --single-version-externally-managed --compile --install-headers /[path]/venv/include/site/python2.7/psycopg2" failed with error code 1 in /private/var/folders/8n/zd44l25535b8kfhz1cfdx7980000gn/T/pip-install-nVe8Y3/psycopg2/

When I am installing psycopg2 in macOS not in virtualenv - this helped me: psycopg2 sierra

Answer by @zganger

But when I am in virtualenv 2.7 (venv) - nothing works, none of the answers even in that post. I was trying to solve this for a week and no luck at all.

Not sure what I else I can do.

When you create the virtualenv and just run these commands, both are failing on psycopg2, if I install any other package all is working nicely except psycopg2.

1. pip install django-toolbelt
2. pip install psycopg2
Radek
  • 1,021
  • 1
  • 17
  • 33
  • What error do you get when installing in virtual env? – hoefling Jun 24 '19 at 20:01
  • Have you installed PostgreSQL? `brew install postgresql` – wencakisa Jun 24 '19 at 20:02
  • @hoefling The error above in the question - ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'cc' failed with exit status 1 – Radek Jun 25 '19 at 05:06
  • @wencakisa yes 1st installed via brew and then created the virtualenv, activate it and then django-toolbelt - error, so did pip install psycopg2 - error as well... – Radek Jun 25 '19 at 05:07
  • This may help https://stackoverflow.com/questions/5420789/how-to-install-psycopg2-with-pip-on-python – Vignesh Ammasi Jun 25 '19 at 07:08
  • @Radek What about `xcode-select --install` ? – wencakisa Jun 25 '19 at 07:50
  • @VigneshAmmasi Mostly that is for linux - but I saw there for mac - and those I have already tried especially exporting path which is to Postgres.app - and no luck - it works for my mac not in virtualenv - but when I create the virtualenv, it does not work - it worked in High Sierra not Mojave. – Radek Jun 25 '19 at 16:43
  • @wencakisa I have tried that also "command line tools are already installed, use "Software Update" to install updates" - and I have no any other updates... – Radek Jun 25 '19 at 16:44
  • @wencakisa On 15th of July new command line tools were released and that fixed the issue. – Radek Jul 23 '19 at 16:03

1 Answers1

0

So, I have tried everything what I could and what I have found is my Mojave version was

10.14.5

and that was till July 14th 2019 up to date version and it did not work.

I have updated to the newest version

10.14.6 and Command Line Tools 10.3

which was released today (July 15th 2019), and it worked perfectly.

Probably there is an issue in previous command line tools or the 10.14.5 version of Mojave

This update worked: Command Line Tools 10.3 / Mojave 10.14.d

Radek
  • 1,021
  • 1
  • 17
  • 33