Error on import psycopg2

40 views
Skip to first unread message

Maryam Yousaf

unread,
Sep 15, 2021, 12:10:08 PMSep 15
to Django users
Hello,

I need psycopg2 for postgres database in django. While installing it, I am getting below error. I tried everything on internet but it still there. Kindly help me out.

Error:
"File "/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: dlopen(/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so, 2): Symbol not found: _PQbackendPID
  Referenced from: /Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so
  Expected in: flat namespace
 in /Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so"

Regards,
Maryam.



This email and any files transmitted with it contain confidential information and/or privileged or personal advice. This email is intended for the addressee(s) stated above only. If you are not the addressee of the email please do not copy or forward it or otherwise use it or any part of it in any form whatsoever. If you have received this email in error please notify the sender and remove the e-mail from your system. Thank you.

This is an email from the company Just Eat Takeaway.com N.V., a public limited liability company with corporate seat in Amsterdam, the Netherlands, and address at Oosterdoksstraat 80, 1011 DK Amsterdam, registered with the Dutch Chamber of Commerce with number 08142836 and where the context requires, includes its subsidiaries and associated undertakings.

Kasper Laudrup

unread,
Sep 15, 2021, 1:15:43 PMSep 15
to django...@googlegroups.com
On 15/09/2021 16.40, 'Maryam Yousaf' via Django users wrote:
> Hello,
>
> I need psycopg2 for postgres database in django. While installing it, I
> am getting below error. I tried everything on internet but it still
> there. Kindly help me out.
>

Did you try this:

https://stackoverflow.com/questions/65059310/apple-m1-install-psycopg2-package-symbol-not-found-pqbackendpid

I don't know much about MacOSX, but I would assume you have an
unsupported version of Postgres installed.

Kind regards,

Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

FIRDOUS BHAT

unread,
Sep 15, 2021, 1:36:23 PMSep 15
to django...@googlegroups.com
Try installing this package,

pip install psycopg2-binary

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d667e7fa-57a7-ee16-0390-6834e0f0f006%40stacktrace.dk.

Vinay Bagare

unread,
Sep 17, 2021, 12:47:27 PMSep 17
to django...@googlegroups.com
Try

>> psycopg2-binary

Best,
Vinay Bagare

Sent from my iPhone

> On Sep 15, 2021, at 12:15 PM, Kasper Laudrup <lau...@stacktrace.dk> wrote:
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d667e7fa-57a7-ee16-0390-6834e0f0f006%40stacktrace.dk.
> <OpenPGP_0xE5D9CAC64AAA55EB.asc>

Maryam Yousaf

unread,
Sep 17, 2021, 1:28:18 PMSep 17
to django...@googlegroups.com
Thank you all. It was resolved by making new virtual environment and installing it again 

Aashish Kumar

unread,
Sep 17, 2021, 2:18:28 PMSep 17
to django...@googlegroups.com
install this package 👇

pip install psycopg2-binary

It works perfectly 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Felix Orinda

unread,
Sep 19, 2021, 8:46:37 AMSep 19
to django...@googlegroups.com
pip install psycopg2-binary
Should work for you. Give me feedback on whether it has worked or not

Reply all
Reply to author
Forward
0 new messages