Search code examples
postgresqlmacosopensslpgpython-venv

Cannot install psycopg2 on venv MacOSX Mojave


Good Day! I cannot install psycopg2 lib through pip3 on my venv and I am not quite sure what is the problem. I have successfully installed postgresql, libpq and I even installed gem pg. But the problem is still there:

Command "/Users/massakeel/Desktop/untitled1/venv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/wc/_r5j9z2s00z5x4rk3xxdsn5h0000gn/T/pip-install-_kv_trob/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/wc/_r5j9z2s00z5x4rk3xxdsn5h0000gn/T/pip-record-1tzkkfi1/install-record.txt --single-version-externally-managed --compile --install-headers /Users/massakeel/Desktop/untitled1/venv/include/site/python3.6/psycopg2" failed with error code 1 in /private/var/folders/wc/_r5j9z2s00z5x4rk3xxdsn5h0000gn/T/pip-install-_kv_trob/psycopg2/

A more convenient image is here. What I understood from the trace is that theres a problem with a openssl library, however it is up to date. Any help is much appreciated.


Solution

  • Unfortunately, I haven't found the reason why default psycopg2 is not running on my Mac. However, psycopg2-binary works just fine.

    pip install psycopg2-binary