Subject: Broken python3-psycopg2 for F24 / PG 9.6

From: Oskari Saarenmaa <[email-masked]>
Date: Wed, 24 Aug 2016 22:55:43 +0300

Hi,

http://yum.postgresql.org/9.6/fedora/fedora-24-x86_64/ contains a 
python3-psycopg2-2.6.2-1.f24.x86_64.rpm package which is lacking the 
_psycopg.so file, making the package unusable.

None of the other Fedora / PG version combinations I checked appear to 
have psycopg2 packages so it seems to me that it shouldn't be published 
for F24 / PG 9.6 either.

/ Oskari

-- 
Sent via pgsql-pkg-yum mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-pkg-yum

---

From: Oskari Saarenmaa <[email-masked]>
Date: Mon, 26 Sep 2016 12:40:52 +0300

> have psycopg2 packages so it seems to me that it shouldn't be published

An updated package (python3-psycopg2-2.6.2-2.f24.x86_64) was uploaded 
recently, it's still broken.  Could you please remove it from the repo? 
It shouldn't be needed by anything afaict.

/ Oskari

---

From: Devrim Gündüz <[email-masked]>
Date: Mon, 26 Sep 2016 13:26:09 +0300

Hi,

>  Could you please remove it from the repo?  It shouldn't be needed by
> anything afaict.

It is needed by pgadmin4, that is why I pushed that update.

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

---

From: Devrim Gündüz <[email-masked]>
Date: Mon, 26 Sep 2016 13:27:20 +0300

Hi,

> have psycopg2 packages so it seems to me that it shouldn't be published 

Starting Fedora 24, Python3 support is added to most of the Python packages,
that is why you cannot see this subpackage in other distros. This package is
under a conditional.

Regards,

---

From: Oskari Saarenmaa <[email-masked]>
Date: Mon, 26 Sep 2016 23:20:04 +0300

> that is why you cannot see this subpackage in other distros. This package is

The python3-psycopg2 package is broken and unusable as it is.  It's 
missing the essential _psycopg.so file:

 >>> import psycopg2
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   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'

Also, Fedora 24 provides python3-psycopg2 2.6.1 by default, do we really 
need 2.6.2 for pgadmin4?

Thanks,
Oskari

---

From: Devrim Gündüz <[email-masked]>
Date: Mon, 26 Sep 2016 23:38:32 +0300

Hi,

On Mon, 2016-09-26 at 23:20 +0300, Oskari Saarenmaa wrote:
>  >>> import psycopg2

That is installed with python-psycopg2 package:

/usr/lib64/python2.7/site-packages/psycopg2/_psycopg.so

When/how do you get this?

> Also, Fedora 24 provides python3-psycopg2 2.6.1 by default,

You mean upstream Fedora? I don't care about the versions there. :)

>  do we really  need 2.6.2 for pgadmin4?

We always keep up2date with releases, but I meant 2.6.2-2 :

$ rpm -q --changelog python-psycopg2
* Tue Sep 13 2016 Devrim Gündüz <[email-masked]> 2.6.2-2
- Move python-debug (PY2 version) package into non-py3 builds.
  We need this at least for pgadmin4.

Cheers,

---

From: Oskari Saarenmaa <[email-masked]>
Date: Mon, 26 Sep 2016 23:42:26 +0300

> When/how do you get this?

Python 2 and Python 3 require their own shared libraries.  The Python 2 
psycopg2 package includes a _psycopg.so file, but the Python 3 package 
doesn't, try: python3 -c 'import psycopg2'

> You mean upstream Fedora? I don't care about the versions there. :)

I'd prefer not to replace packages provided by upstream unless it's 
absolutely necessary, but I guess that's ok if it's the pg yum repo policy.

/ Oskari

---

From: Devrim Gündüz <[email-masked]>
Date: Mon, 26 Sep 2016 23:57:36 +0300

Hi,

> doesn't, try: python3 -c 'import psycopg2'

I'm not a Python guy, so:

$ python3 -c 'import psycopg2'
$ 

I did not get any errors, is that ok?

I started to think that this is a missing dependency somewhere.

Regards,

---

From: Oskari Saarenmaa <[email-masked]>
Date: Tue, 27 Sep 2016 00:06:31 +0300

> I did not get any errors, is that ok?

That's weird.  The 
https://yum.postgresql.org/9.6/fedora/fedora-24-x86_64/python3-psycopg2-2.6.2-2.f24.x86_64.rpm 
package that I'm seeing definitely doesn't contain a _psycopg.so package 
which is required by psycopg2.

Try python3 -c 'from psycopg2 import _psycopg; print(_psycopg)' and run 
rpm -qf on the reported file.

On stock Fedora 24 without PGDG repos I get:

$ python3 -c 'from psycopg2 import _psycopg; print(_psycopg)'
<module 'psycopg2._psycopg' from 
'/usr/lib64/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-x86_64-linux-gnu.so'>
$ rpm -qf 
/usr/lib64/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-x86_64-linux-gnu.so
python3-psycopg2-2.6.1-5.fc24.x86_64

/ Oskari

---

From: Devrim Gündüz <[email-masked]>
Date: Tue, 27 Sep 2016 00:18:08 +0300

Hi,

> rpm -qf on the reported file.

Can you please install python3-psycopg2-debug from our repo, and try again?
'cause:

$ python3 -c 'from psycopg2 import _psycopg; print(_psycopg)'
<module 'psycopg2._psycopg' from '/usr/lib64/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-x86_64-linux-gnu.so'>

$ rpm -qf /usr/lib64/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-x86_64-linux-gnu.so
python3-psycopg2-debug-2.6.2-2.f24.x86_64

It looks RPMs are missing dependency -debug subpackage...

Regards,

---

From: Oskari Saarenmaa <[email-masked]>
Date: Tue, 27 Sep 2016 00:20:47 +0300

> It looks RPMs are missing dependency -debug subpackage...

Ok, installing the -debug package makes it work.  Apparently the .so is 
in the debug package for some reason.  It has nothing to do with debug 
functionality though, it should be moved to the main package.

/ Oskari

---

From: Devrim Gündüz <[email-masked]>
Date: Wed, 28 Sep 2016 13:09:26 +0300

Hi,

> functionality though, it should be moved to the main package.

That file is generated with python3-debug command, so I think that is the best
place to push it, right?

Regards,

---

From: Oskari Saarenmaa <[email-masked]>
Date: Wed, 28 Sep 2016 13:15:02 +0300

> That file is generated with python3-debug command, so I think that is the best

The .so is generated by "setup.py build" and should be included in the 
main package as it's done in the upstream Fedora package.  The main 
package is unusable without the .so file in it.

Currently just enabling the PGDG repo and running "dnf upgrade" on a 
Fedora 24 system breaks all existing Python 3 applications depending on 
psycopg2.

/ Oskari

---

From: Devrim Gündüz <[email-masked]>
Date: Thu, 06 Oct 2016 14:37:37 +0300

Hi Oskari,

> Fedora 24 system breaks all existing Python 3 applications depending on 

Ok, I'll take a look at this later tonight.

Regards,

---

From: Devrim Gündüz <[email-masked]>
Date: Fri, 07 Oct 2016 12:12:21 +0300

Hi Oskari,

> Fedora 24 system breaks all existing Python 3 applications depending on 

I think I fixed the issue in spec file -- it seems I missed one file in the
main package as you wrote. That caused the breakage. 

So, pushed new packages (2.6.2-3) to repositories. They will sync in next hour.

Thanks for your patience and help.

Regards,