Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem loading psycopg2 with glibc 2.26 #2

Closed
bluetech opened this issue Aug 24, 2017 · 11 comments
Closed

Problem loading psycopg2 with glibc 2.26 #2

bluetech opened this issue Aug 24, 2017 · 11 comments

Comments

@bluetech
Copy link

@bluetech bluetech commented Aug 24, 2017

The importing fails. I think the following shell session contains all necessary details (glibc 2.26 was recently released, updating to this version triggers the problem):

$ uname -a
Linux ran 4.12.4-1-ARCH #1 SMP PREEMPT Fri Jul 28 18:54:18 UTC 2017 x86_64 GNU/Linux

$ pacman -Qi glibc | grep Version
Version         : 2.26-1

$ python --version
Python 3.6.2

$ python -m venv venv
$ . venv/bin/activate

(venv) $ pip install psycopg2
Collecting psycopg2
  Downloading psycopg2-2.7.3-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
    100% |████████████████████████████████| 2.7MB 378kB/s 
Installing collected packages: psycopg2
Successfully installed psycopg2-2.7.3

(venv) $ python
Python 3.6.2 (default, Jul 20 2017, 03:52:27) 
[GCC 7.1.1 20170630] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "venv/lib/python3.6/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: venv/lib/python3.6/site-packages/psycopg2/.libs/libresolv-2-c4c53def.5.so: symbol __res_maybe_init, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference

Perhaps I should report this to the manylinux repository; if so please let me know.

@bluetech
Copy link
Author

@bluetech bluetech commented Aug 24, 2017

In case it wasn't clear, installing from sdist works:

(venv) $ pip uninstall psycopg2
  Successfully uninstalled psycopg2-2.7.3

(venv) $ pip install --no-binary :all: psycopg2
Collecting psycopg2
  Downloading psycopg2-2.7.3.tar.gz (425kB)
    100% |████████████████████████████████| 430kB 601kB/s 
Installing collected packages: psycopg2
  Running setup.py install for psycopg2 ... done

(venv) $ python
Python 3.4.6 (default, Aug 24 2017, 12:52:24) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>>
@dvarrazzo
Copy link
Member

@dvarrazzo dvarrazzo commented Aug 24, 2017

Sorry, I know it sounds silly but... "have you tried restarting it"?

I've seen old reports of this bug, e.g. https://lists.debian.org/debian-glibc/2005/08/msg00363.html that seem suggesting a runtime problem.

If not, yes please, report it to manylinux, because it seems suggesting an ABI change which is exactly what the guys tried to avoid.

@bluetech
Copy link
Author

@bluetech bluetech commented Aug 24, 2017

I restarted the computer but it didn't help.

For now I added

--no-binary psycopg2

to the top of my requirements.txt to prevent pip from using the wheel. In fact, I prefer to use the system shared libraries over the bundled ones anyway, so I'll keep it regardless of the issue.

Thanks!

@bluetech bluetech closed this Aug 24, 2017
dvarrazzo added a commit to psycopg/psycopg2 that referenced this issue Aug 25, 2017
dvarrazzo added a commit that referenced this issue Aug 25, 2017
dvarrazzo added a commit that referenced this issue Aug 25, 2017
@dvarrazzo
Copy link
Member

@dvarrazzo dvarrazzo commented Aug 25, 2017

Hello @bluetech

Could you please test if the wheel package at http://initd.org/psycopg/upload/psycopg2-2.7.3.1.dev0/ works ok? If so I'll push a patch to auditwheel. Thank you very much.

pip install http://initd.org/psycopg/upload/psycopg2-2.7.3.1.dev0/psycopg2-2.7.3.1.dev0-cp36-cp36m-manylinux1_x86_64.whl should do.

@dvarrazzo dvarrazzo reopened this Aug 25, 2017
@bluetech
Copy link
Author

@bluetech bluetech commented Aug 25, 2017

Yes, it fixes the problem. Specifically, the import works and the test suite of my project passes.

@dvarrazzo
Copy link
Member

@dvarrazzo dvarrazzo commented Aug 25, 2017

Thank you very much for testing! I will release an updated wheel package.

@dvarrazzo dvarrazzo closed this Aug 25, 2017
lsh-0 added a commit to elifesciences/lax that referenced this issue Sep 29, 2017
encountered this psycopg/psycopg2-wheels#2 after updating system
mart-e added a commit to odoo/odoo that referenced this issue Nov 13, 2017
2.7.1 is broken with glibc 2.66
upgrading to latest working version: 2.7.3
cf psycopg/psycopg2-wheels#2

Add CLA

Fixes #19511
Closes #19512
@snmpboy
Copy link

@snmpboy snmpboy commented Nov 16, 2017

Had the same issue and that dev from git hub worked!! Although, it only seemed to be a problem with running from a virtual environment. My image for docker ran fine. Go figure.

@JoelAtDeluxe
Copy link

@JoelAtDeluxe JoelAtDeluxe commented Nov 28, 2017

I had this issue, but doing pip install psycopg2 --upgrade fixed my issue

@yw-fang
Copy link

@yw-fang yw-fang commented Feb 1, 2018

Just now I had this problem when launching a code in the Ubuntu 17.1 terminal. My solution was 'conda install psycopg2' to replace the old version.

jerojasro added a commit to cansadadeserfeliz/desparchado that referenced this issue Apr 16, 2018
bigbear3001 pushed a commit to ap-wtioit/odoo that referenced this issue Jun 11, 2018
bigbear3001 pushed a commit to ap-wtioit/odoo that referenced this issue Jun 11, 2018
StephanRozendaal added a commit to neobis-it/odoo that referenced this issue Aug 13, 2018
2.7.1 is broken with glibc 2.66
upgrading to latest working version: 2.7.3
cf psycopg/psycopg2-wheels#2

Add CLA

Fixes odoo#19511
Closes odoo#19512
LarsMichelsen pushed a commit to tribe29/checkmk that referenced this issue Feb 20, 2019
jlev added a commit to OpenSourceActivismTech/call-power that referenced this issue Mar 15, 2019
@ElliotVilhelm
Copy link

@ElliotVilhelm ElliotVilhelm commented May 10, 2019

Had this issue and following @JoelAtDeluxe pip install psycopg2 --upgrade threw the error

    Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'

I followed
https://stackoverflow.com/questions/28253681/you-need-to-install-postgresql-server-dev-x-y-for-building-a-server-side-extensi

sudo apt-get install postgresql
sudo apt-get install python-psycopg2
sudo apt-get install libpq-dev

Then running pip install psycopg2 --upgrade succeeds.

isra17 added a commit to Flared/SMART that referenced this issue Sep 9, 2019
isra17 added a commit to Flared/SMART that referenced this issue Sep 9, 2019
hectcastro added a commit to OpenTreeMap/otm-core that referenced this issue Oct 8, 2019
jbothma added a commit to OpenUpSA/nearby that referenced this issue Jan 13, 2020
hectcastro added a commit to project-icp/bee-pollinator-app that referenced this issue Feb 17, 2020
Something about the wheel for psycopg2==2.7.x loads external operating
system libraries in a way that is incompatible with the versions of
those libraries provided on Trusty. To avoid any issues with bundled
wheel binaries, the most recent non psycopg2-binary package is being
installed.

Seems related to psycopg/psycopg2-wheels#2.

No reference to psycopg2 is made in requirements.txt because the
application expects psycopg2 to already be there (via Ansible and the
postgresql-support role).
hectcastro added a commit to project-icp/bee-pollinator-app that referenced this issue Feb 17, 2020
Something about the wheel for psycopg2==2.7.x loads external operating
system libraries in a way that is incompatible with the versions of
those libraries provided on Trusty. To avoid any issues with bundled
wheel binaries, the most recent non psycopg2-binary package is being
installed.

Seems related to psycopg/psycopg2-wheels#2.

No reference to psycopg2 is made in requirements.txt because the
application expects psycopg2 to already be there (via Ansible and the
postgresql-support role).
@QaidjoharBarbhaya
Copy link

@QaidjoharBarbhaya QaidjoharBarbhaya commented Jan 30, 2021

I restarted the computer but it didn't help.

For now I added

--no-binary psycopg2

to the top of my requirements.txt to prevent pip from using the wheel. In fact, I prefer to use the system shared libraries over the bundled ones anyway, so I'll keep it regardless of the issue.

Thanks!

This worked for me:

pip install psycopg2-binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

7 participants