newbie Mac switcher again... django prob on MacBook Pro Tiger... no psycopg2

Micheal Cooper cooper.me at gmail.com
Fri Dec 28 04:17:04 PST 2007


I addressed a psycopg question to this list before, and I am grateful for
the guidance that I received.

The recommendation was that I start over, so I removed all my ports and then
MacPorts altogether, and then I made double-plus-sure that all installations
of postgresql and psycopg2 were removed from the system. I then reinstalled
everything, using MacPorts defaults and following the rules with no
modifications or customizations.

Though I finally got my database users, etc. down and my django up and
running, when it came time to use the Python-Postgresql functionality, I got
the following:

------
netadminmac:~/Documents/djangotests/mysite mcooper$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/__init__.py",
line 272, in execute_manager
    utility.execute()
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/__init__.py",
line 219, in execute
    self.fetch_command(subcommand).run_from_argv( self.argv)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py",
line 72, in run_from_argv
    self.execute(*args, **options.__dict__)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py",
line 85, in execute
    self.validate()
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py",
line 112, in validate
    num_errors = get_validation_errors(s, app)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/validation.py",
line 22, in get_validation_errors
    from django.db import models, connection
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/__init__.py",
line 17, in <module>
    backend = __import__('%s%s.base' % (_import_path,
settings.DATABASE_ENGINE ), {}, {}, [''])
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/backends/postgresql_psycopg2/base.py",
line 15, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module:
No module named psycopg2
------


So it seems that Postgresql and Python cannot talk, but here are my ports:
------
netadminmac:~/Documents/djangotests/mysite mcooper$ sudo port installed
Password:
The following ports are currently installed:
  apr @1.2.12_0 (active)
  apr-util @1.2.12_0 (active)
  bison @2.3_1 (active)
  db44 @4.4.20_1+darwin_8 (active)
  expat @2.0.1_0 (active)
  gawk @ 3.1.5_2 (active)
  gettext @0.17_2 (active)
  libiconv @1.12_0+darwin_8 (active)
  m4 @1.4.10_1 (active)
  ncurses @5.6_0+darwin_8 (active)
  ncursesw @5.6_0+darwin_8 (active)
  neon @0.26.4_0 (active)
  openssl @0.9.8g_0 (active)
  postgresql81 @8.1.10_0 (active)
  postgresql81-server @8.1.10_0 (active)
  py25-psycopg2 @2.0.5.1_0 (active)
  python25 @2.5.1_4+darwin_8 (active)
  readline @5.2.007_0 (active)
  sqlite3 @3.5.4_0+darwin_8 (active)
  subversion @1.4.5_0 (active)
  zlib @1.2.3_1 (active)
------



Here is a list of locations of psycopg:
------
netadminmac:~/Documents/djangotests/mysite mcooper$ locate psycopg
/opt/local/lib/python2.5/site-packages/psycopg2
...
/opt/local/var/macports/distfiles/python/psycopg2-2.0.5.1.tar.gz
...
/opt/local/var/macports/software/py25-psycopg2
/opt/local/var/macports/software/py25-psycopg2/2.0.5.1_0
...
/opt/local/var/macports/software/py25-psycopg2/2.0.5.1_0/opt/local/lib/python2.5
/opt/local/var/macports/software/py25-psycopg2/2.0.5.1_0/opt/local/lib/python2.5/site-packages
------


Here is my ~/.profile:
------
netadminmac:~ mcooper$ cat .profile
stty erase
export LC_CTYPE=en_US.UTF-8
# Setting the path for MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Setting PATH for MacPython 2.5
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
export DISPLAY=:0.0
export PATH=$PATH:/opt/local/lib/postgresql81/bin
alias pgstart="sudo su postgres81 -c 'pg_ctl -D /Users/DB/postgresql -l
/Users/DB/postgresql/logfile start'"
alias pgstop="sudo su postgres81 -c 'pg_ctl -D /Users/DB/postgresql stop -m
fast'"
alias pgstatus="sudo su postgres81 -c 'pg_ctl status -D
/Users/DB/postgresql'"
------


And here is my attempt to figure out which competing versions of Python may
be installed. It seems that there are two Python2.5 installations -
/Library/Frameworks/Python.framework/Versions/2.5/bin/python and
/opt/local/bin/python2.5:
------
/Applications/Komodo IDE.app
/Contents/Frameworks/Python.framework/Versions/2.5/bin/python
/Applications/Komodo IDE.app
/Contents/Frameworks/Python.framework/Versions/2.5/bin/python-config
/Applications/Komodo IDE.app
/Contents/Frameworks/Python.framework/Versions/2.5/bin/python2.5
/Applications/Komodo IDE.app
/Contents/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
...
/Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3

...
/Library/Frameworks/Python.framework/Versions/2.5/bin/python
/Library/Frameworks/Python.framework/Versions/2.5/bin/python-config
/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
...
/opt/local/bin/python2.5
/opt/local/bin/python2.5-config
/opt/local/include/python2.5
...
/opt/local/var/macports/software/py25-psycopg2/2.0.5.1_0/opt/local/lib/python2.5
/opt/local/var/macports/software/py25-psycopg2/2.0.5.1_0/opt/local/lib/python2.5/site-packages

...
/usr/bin/python
/usr/bin/python2.3
/usr/bin/pythonw
/usr/bin/pythonw2.3
/usr/include/python2.3
------


So is /Library/Frameworks/Python.framework/Versions/2.5/bin/python the Apple
version and /opt/local/bin/python2.5 the MacPorts version? If that is the
case, would it solve my problem to just point to the MacPorts version in my
~/.profile? I was going to try this, but the /opt/local/bin/python2.5 is a
file, not a directory, so it looks like they are not equal.

Could someone please help me? I am trying to learn django and python, and I
would like to do it on the Mac. However, I have to tell you that the install
on my Windows machine was a no-brainer series of "Next" clicks and some
posgresql tinkerin at  the end. This django install has really made me
question the move to Mac.


-- 
Miyazaki, Japan (GMT+9, no DST)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-users/attachments/20071228/0b09f1d1/attachment-0001.html


More information about the macports-users mailing list