Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 791
Prashant Pandey Avatar asked Oct 27 '17 01:10

Prashant Pandey


People also ask

Does psycopg2 work with Python 3?

The current psycopg2 implementation supports: Python 2 versions from 2.6 to 2.7. Python 3 versions from 3.2 to 3.6. PostgreSQL server versions from 7.4 to 9.6.

Does psycopg2 need PostgreSQL?

The psycopg2-binary package is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements.

Is psycopg2 the same as psycopg2-binary?

psycopg2-binary and psycopg2 both give us the same code that we interact with. The difference between the two is in how that code is installed in our computer.


1 Answers

Reinstall psycopg2 and use the binary.

sudo pip uninstall psycopg2    
pip install psycopg2-binary
like image 130
Kenly Avatar answered Sep 24 '22 03:09

Kenly