public inbox for [email protected]  
help / color / mirror / Atom feed
ImportError: symbol not found in flat namespace '_PQbackendPID'
2+ messages / 2 participants
[nested] [flat]

* ImportError: symbol not found in flat namespace '_PQbackendPID'
@ 2022-09-06 16:06 Gil Sousa <[email protected]>
  2022-09-07 00:08 ` Re: ImportError: symbol not found in flat namespace '_PQbackendPID' Daniele Varrazzo <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Gil Sousa @ 2022-09-06 16:06 UTC (permalink / raw)
  To: [email protected]

Hi all,

I am trying to use psycopg2 for the very first time, though I am stumbling
with an error when trying to import the module:

✗ python3.9 radars_import.py
Traceback (most recent call last):
  File "/Users/gilsousa/Documents/git Projects/ReportGen/radars_import.py",
line 2, in <module>
    import psycopg2
  File
"/Users/gilsousa/Library/Python/3.9/lib/python/site-packages/psycopg2/__init__.py",
line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError:
dlopen(/Users/gilsousa/Library/Python/3.9/lib/python/site-packages/psycopg2/_
psycopg.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace
'_PQbackendPID'

I made sure that I have the packages installed, both psycopg2
and psycopg2-binary. I even tried to uninstall both and just try one at a
time, also didn't work.

How can I fix this problem?

Thank you,

Gil Sousa
www.gilsousa.eu


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ImportError: symbol not found in flat namespace '_PQbackendPID'
  2022-09-06 16:06 ImportError: symbol not found in flat namespace '_PQbackendPID' Gil Sousa <[email protected]>
@ 2022-09-07 00:08 ` Daniele Varrazzo <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniele Varrazzo @ 2022-09-07 00:08 UTC (permalink / raw)
  To: Gil Sousa <[email protected]>; +Cc: [email protected]

Hello,

On Tue, 6 Sept 2022 at 17:06, Gil Sousa <[email protected]> wrote:
>
> Hi all,
>
> I am trying to use psycopg2 for the very first time, though I am stumbling with an error when trying to import the module:
>
> ✗ python3.9 radars_import.py
> Traceback (most recent call last):
>   File "/Users/gilsousa/Documents/git Projects/ReportGen/radars_import.py", line 2, in <module>
>     import psycopg2
>   File "/Users/gilsousa/Library/Python/3.9/lib/python/site-packages/psycopg2/__init__.py", line 51, in <module>
>     from psycopg2._psycopg import (                     # noqa
> ImportError: dlopen(/Users/gilsousa/Library/Python/3.9/lib/python/site-packages/psycopg2/_psycopg.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_PQbackendPID'
>
> I made sure that I have the packages installed, both psycopg2 and psycopg2-binary. I even tried to uninstall both and just try one at a time, also didn't work.

You should install only one of them. If you are using an apple M1,
psycopg2-binary doesn't actually install a binary package and falls
back to building from source.

> How can I fix this problem?

I don't have a macOS but the problem has surfaced often, according to
google. It seems related to the wrong installation of the libpq, and
it doesn't help that a few days ago Homebrew has broken the libpq
installation <https://github.com/psycopg/psycopg2/issues/1492;.

See https://gist.github.com/peter-gy/0ebe072acb9065944ecb04d95a4c3096
for an example of someone fixing your problem.

Cheers

-- Daniele





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-09-07 00:08 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 16:06 ImportError: symbol not found in flat namespace '_PQbackendPID' Gil Sousa <[email protected]>
2022-09-07 00:08 ` Daniele Varrazzo <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox