Re: Problems with psycopg2 on OS X 10.6
Decibel! <[email protected]> Sat, 24 Apr 2010 12:13:30 -0500
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
Yeah, turns out I'm picking up Apple's crappy built-in python. Haven't been able to figure out where it's making it into my path yet... On Fri, Apr 16, 2010 at 11:05:06AM +0300, Hannu Krosing wrote: > On Thu, 2010-04-15 at 17:41 -0500, Jim Nasby wrote: > > From: Jim Nasby <[email protected]> > > Date: April 15, 2010 7:47:52 AM CDT > > To: psycopg-IAPFreCvJWPBWskQ1e/[email protected] > > Subject: Problems with psycopg2 on OS X 10.6 > > > > Has anyone been able to get psycopg2 to work out of macports? PgQ keeps telling me to install psyccopg2. It's installed, but I can't import it: > > I got it working after doing the following > > First I cleaned up my macports as I was unable to > "port install postgresql84" due to gettext being 32bit only > as described in: > > http://trac.macports.org/wiki/Migration > > after that did: > > sudo port install postgresql84 > sudo port install python26 > sudo port install py26-psycopg2 > > python2.6 > hannu@imac:~$ python2.6 > Python 2.6.5 (r265:79063, Apr 15 2010, 22:25:04) > [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import psycopg2 > >>> psycopg2.__file__ > '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/__init__.pyc' > >>> psycopg2._psycopg.__file__ > '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so' > >>> con = psycopg2.connect('') > >>> cur = con.cursor() > >>> cur.execute('select * from pg_user') > >>> cur.fetchall() > [('postgres', 10, True, True, True, '********', None, None), > ('hannu', 16384, True, True, True, '********', None, None)] > > > > [email protected][6:49]~/src:79%sudo port install py26-psycopg2 +postgresql83 > > ---> Computing dependencies for py26-psycopg2 > > ---> Fetching py26-psycopg2 > > ---> Verifying checksum(s) for py26-psycopg2 > > ---> Extracting py26-psycopg2 > > ---> Applying patches to py26-psycopg2 > > ---> Configuring py26-psycopg2 > > ---> Building py26-psycopg2 > > ---> Staging py26-psycopg2 into destroot > > ---> Installing py26-psycopg2 @2.0.14_0+postgresql83 > > ---> Activating py26-psycopg2 @2.0.14_0+postgresql83 > > ---> Cleaning py26-psycopg2 > > [email protected][6:49]~/src:80%python > > Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) > > [GCC 4.2.1 (Apple Inc. build 5646)] on darwin > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import psycopg2 > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > File "build/bdist.macosx-10.6-universal/egg/psycopg2/__init__.py", line 69, in <module> > > File "build/bdist.macosx-10.6-universal/egg/psycopg2/_psycopg.py", line 7, in <module> > > File "build/bdist.macosx-10.6-universal/egg/psycopg2/_psycopg.py", line 6, in __bootstrap__ > > ImportError: dlopen(/Users/decibel/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID > > Referenced from: /Users/decibel/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so > > Expected in: flat namespace > > in /Users/decibel/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so > > >>> ^D > > > > What's up with the ~/.python-eggs directory?? > > Did you do a local install into your home dir or a global one ? > > Perhaps you have an old leftover install of psycopg2 in your home dir > which gets picked up by error ? > > Notice that in my case, both > > >>> psycopg2.__file__ > '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/__init__.pyc' > >>> psycopg2._psycopg.__file__ > '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so' > > are in the same directory > > > -- > Hannu Krosing http://www.2ndQuadrant.com > PostgreSQL Scalability and Availability > Services, Consulting and Training > > -- Decibel!, aka Jim C. Nasby, Database Architect [email protected] Give your computer some brain candy! www.distributed.net Team #1828