Error Loading Psycopg2 Module Libpq.so.5
Varrazzo's tickets Federico Di Gregorio's tickets Messages Milestones more 3psycopg3 Search Find tickets: [help] Keyword searching Type To find responsible:me tickets assigned to you tagged:"@high" tickets tagged @high milestone:next tickets in the upcoming milestone state:invalid tickets with the state invalid created:"last week" tickets created last week sort:number, importance, updated tickets sorted by #, importance or updated Combine keywords for powerful searching. Use advanced searching » This project is archived and is in readonly mode. #119 ✓invalid psycopg2-2.4.5 - and PostgreSQL 9.1.4, cannot get libpq.so.5 linked in Reported by Lou Picciano | August 17th, 2012 @ 03:12 AM Ciao, Daniele! Trying to make wider use of psycopg now, with builds of latest version. With psycopg2-2.4.5 - and PostgreSQL 9.1.4, cannot get libpq.so.5 linked into psycopg2. Have tried both the seteup.py clean (build, install) approach and the $ make clean, make approach with similar results. Have also modified setup.cfg extensively to include /usr/pgsql/9.1/bin/pg_config, various lib directories, etc. Please note that build and install work without any error. At runtime, however: import psycopg2 Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/site-packages/psycopg2/init.py", line 67, in from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: ld.so.1: isapython2.6: fatal: libpq.so.5: open failed: No such file or directory Of course, placing the lib in LD_LIBRARY_PATH works in the local environment. How to get the linker to '-I' the libpq library, preferably via the setup.cfg file? (Changing the runtime environment, globally, is not an option in this context; we may have several versions of both PostgreSQL and Python in play at any given moment). Tks in advance, Lou Comments and changes to this ticket Federico Di Gregorio August 17th, 2012 @ 07:28 AM State changed from new to invalid Build-time linking and run-time linking are different things. This is how run-time (dynamic) linking works: you need to put the libpq library into one of the default locations (see /etc/ld.so.conf and "man ld.so
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen
here for a quick overview of the site Help Center Detailed http://stackoverflow.com/questions/1383126/django-python-beginner-error-when-executing-python-manage-py-syncdb-psycopg2 answers to any questions you might have Meta Discuss the http://www.geilthings.com/wiki/Python_and_PostgreSQL workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the error loading Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Django/Python Beginner: Error when executing python manage.py syncdb - psycopg2 not found up vote 21 down vote favorite 7 I have Pythong2.6, error loading psycopg2 psycopg2 and pgAdmin3 installed using Macports. My settings.py is: DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'mysite' # Or path to database file if using sqlite3. DATABASE_USER = 'postgres' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. The error I get when I run python manage.py syncdb is: Traceback (most recent call last): File "manage.py", line 11, in
(Source: Python.org) List of Python drivers for PostgreSQL: http://wiki.python.org/moin/PostgreSQL Installation # The setuptools module from python must have been installed before, # setuptools includes easy_install. cd /opt/python2.7.2/bin/ # Using the psycopg library (http://initd.org/psycopg/) ./easy_install-2.7 -Z psycopg2 # # Test: # python2.7 # >>> import psycopg2 # >>> ... ImportError: libpq.so.5: cannot open shared object file: No such file or directory... # # Solution: http://www.webtop.com.au/blog/installing-postgresql-and-psycopg2-2009030344 or # http://psycopg.lighthouseapp.com/projects/62710/tickets/44-python-import-error-libpqso5 # Add the path to the file libpq.so.5 to LD_LIBRARY_PATH. # From http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html: # The environment variable LD_LIBRARY_PATH is a colon-separated set of directories where # libraries should be searched for first, before the standard set of directories. # find / -name libpq.so.5 # /usr/local/pgsql/lib/libpq.so.5 # Add path (/usr/local/pgsql/lib) to LD_LIBRARY_PATH and export LD_LIBRARY_PATH in /etc/profile, e.g. # # LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:/usr/lib/oracle/10.2.0.3/client64/lib:/usr/local/pgsql/lib # export LD_LIBRARY_PATH # # Now reload /etc/profile with ". /etc/profile" or "source /etc/profile" . /etc/profile # Test: python2.7 # >>> import psycopg2 # >>> Comments Please enable JavaScript to view the comments powered by Disqus. blog comments powered by Disqus Retrieved from "http://www.geilthings.com/index.php?title=Python_and_PostgreSQL&oldid=1200" Categories: PostgreSQLDriver Toolbox What links here / Related changes / Special pages / Printable version / Permanent link Privacy policy / About GeilThings / Disclaimers / Author: Jesus del Valle This page was last modified on 8 April 2012, at 10:38. This page has been accessed 2,759 times. Powered by Apache, PHP, MySQL, APC, MediaWiki, Semantic MediaWiki, CentOS. Skin: My Remix from the excellent Paul Gu Skin and Twitter Bootstrap. Hosted at Host Europe