Thread: 2.6.2 import error

2.6.2 import error

From
Devrim Gündüz
Date:
Hi,

While working on pgadmin4 packaging, I noticed the following. This is psycopg2
2.6.2 on Fedora 24 and Python 3:

 File "/usr/lib64/python3.5/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: No module named 'psycopg2._psycopg'


I am not a Python guy, so I need some help in here. How can I fix this?

Regards,
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Attachment

Re: 2.6.2 import error

From
Daniele Varrazzo
Date:
Was that psycopg library built on the same system? Python3 mangles the name of the C modules, e.g. it would create something called "_psycopg.cpython-35m.so". Is it where it is expected? Which should be in /usr/lib64/python3.5/site-packages/psycopg2 in your case. Could it be that there is another _psycopg[.whatever].so somewhere else in the system, confusing the importer? I think (but I'm not sure) that the same error could happen because libpq is not found: does ldd -r on the .so return any undefined symbol about the libpq (not about python: these are normal).

On Fri, Sep 2, 2016 at 11:56 AM, Devrim Gündüz <devrim@gunduz.org> wrote:

Hi,

While working on pgadmin4 packaging, I noticed the following. This is psycopg2
2.6.2 on Fedora 24 and Python 3:

 File "/usr/lib64/python3.5/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: No module named 'psycopg2._psycopg'


I am not a Python guy, so I need some help in here. How can I fix this?

Regards,
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Re: 2.6.2 import error

From
Devrim Gündüz
Date:
Hi Daniele,

On Fri, 2016-09-02 at 12:13 +0100, Daniele Varrazzo wrote:
> Was that psycopg library built on the same system?

Yes, all are built on my Fedora 24 box (or installed from YUM repo for F24).

> Python3 mangles the name of the C modules, e.g. it would create something
> called "_ psycopg.cpython-35m.so". Is it where it is expected?

I think this tip fixed the problem. My recent RPMs put those files in -debug
subpackage. Installing it fixed it.

Thank you!

Regards,
-- 
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Attachment