Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.
This repository was archived by the owner on Jun 16, 2021. It is now read-only.

Problem loading psycopg2 with glibc 2.26 #2

Closed
OpenTreeMap/otm-core
#3274

Description

@bluetech

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.

Activity

  1. bluetech commented on Aug 24, 2017

    @bluetech
    Author

    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
    >>>
    
  2. dvarrazzo commented on Aug 24, 2017

    @dvarrazzo
    Member

    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.

  3. bluetech commented on Aug 24, 2017

    @bluetech
    Author

    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!

  4. dvarrazzo commented on Aug 25, 2017

    @dvarrazzo
    Member

    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.

  5. bluetech commented on Aug 25, 2017

    @bluetech
    Author

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

  6. dvarrazzo commented on Aug 25, 2017

    @dvarrazzo
    Member

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

  7. added a commit that references this issue on Sep 29, 2017
  8. snmpboy commented on Nov 16, 2017

    @snmpboy

    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.

  9. 3 remaining items

  10. elliotvilhelm commented on May 10, 2019

    @elliotvilhelm

    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.

  11. added a commit that references this issue on Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions