psycopg2 import error when ubuntu upgraded to 17.10 (from 17.04)
Asked Answered
D

4

8

Everything was working great until I upgraded the OS to Ubuntu 17.10. Now my Django project won't run (python manage.py runserver) because psycopg2 won't import. psycopg2 is already installed with pip (nothing has changed there). To be exact this is the error:

lib/python3.5/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
Donohoe answered 27/10, 2017 at 1:43 Comment(0)
A
4

Try reinstalling psycopg2. It looks like a dynamically linked dependency changed. The database adapters as a rule have compiled components and those are compiled against system files that can change on updates, so on major OS upgrades, you'll almost certainly have to recompile a pip installed version.

Affaire answered 27/10, 2017 at 2:55 Comment(1)
thanks for the answer ! I tried to reinstall psycopg2 earlier but ended up with same errors. But when i tried pip install psycopg2 --no-cache-dir. It works !!Donohoe
T
12

Reinstall psycopg2 and use the binary.

sudo pip uninstall psycopg2    
pip install psycopg2-binary
Thigmotropism answered 19/5, 2018 at 8:23 Comment(0)
C
8

It was a problem of the wheel build tool fixed with the release of a new binary pacakge in psycopg2 2.7.3.1

Carmoncarmona answered 27/10, 2017 at 14:46 Comment(1)
BTW there's detailed description of installation options here initd.org/psycopg/docs/install.html#binary-install-from-pypiKeystroke
A
4

Try reinstalling psycopg2. It looks like a dynamically linked dependency changed. The database adapters as a rule have compiled components and those are compiled against system files that can change on updates, so on major OS upgrades, you'll almost certainly have to recompile a pip installed version.

Affaire answered 27/10, 2017 at 2:55 Comment(1)
thanks for the answer ! I tried to reinstall psycopg2 earlier but ended up with same errors. But when i tried pip install psycopg2 --no-cache-dir. It works !!Donohoe
D
0

I've had the same issue. Apparently, there is a compatibility issue with glibc binaries. The following worked for me:

pip uninstall psycopg2

sudo apt-get install postgresql-server-dev-X.Y (if not already installed)

pip install --no-binary :all: psycopg2

Source: Problem loading psycopg2 with glibc 2.26

Davide answered 10/10, 2018 at 8:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.