1
  • Mac OSX 10.8
  • Python 2.7 (installed with homebrew)
  • PostgreSQL 9.4 (installed with homebrew)
  • psycopg2 2.5 (installed with macports)
  • Django 1.0.4 (installed with homebrew)

I'm using this tutorial and currently trying to configure a database. I edited my settings.py file to reflect the fact that I'm using postgreSQL with psycopg2, but I keep getting this same error, even after I uninstalled and reinstalled django, python, postgreSQL and psycopg2.

From within the mysite directory (created by django), I ranpython manage.py shell and terminal printed a bunch of stuff but at the end:

  File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 20, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2

So I'm guessing the issue is that (django? python?) can't find my psycopg2. As I said I'm pretty new so I'm not all that comfortable messing around with the PATH but if that is the issue could someone walk me through it?

Chris Travers
  • 25,424
  • 6
  • 65
  • 182
aloe-sarah
  • 47
  • 5
  • 1
    Looks like you are missing some dependencies.First do this ` sudo apt-get build-dep python-psycopg2` followed by `pip install psycopg2` . I dont know the mac equivalent of `sudo apt-get` so you would have to figure that out – karthikr Aug 12 '13 at 20:05
  • After a bit of research it looks like there is no mac equivalent of that command, and because I installed psycopg2 using macports, it would have installed all the necessary dependencies anyways. I don't trust that, but I don't know what else to do... – aloe-sarah Aug 13 '13 at 17:23

1 Answers1

0

You are using both macport and homebrew, maybe it is problem. If possible, use pip to install python package.

$ curl -O http://python-distribute.org/distribute_setup.py
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ python distribute_setup.py
$ python get-pip.py
$ pip install psycopg2
$ pip install Django
Curry
  • 885
  • 5
  • 15