tags:

views:

921

answers:

6

hello,

I am new to Python. I have Python2.6 running now. I am following the Tutorial on the Python site. My question is when I try to follow the instructions here:

http://py-psycopg.darwinports.com/

I get something like...

sudo port install py-psycopg
... bunch of errors here...
Error: The following dependencies failed to build: py-mx python24

I am running MacOS X 10.4.

How do i make this work?

Any reply would be greatly appreciated.

UPDATE:

After running the code below I get the errors below:

$ sudo port install py26-psycopg2
Warning: Skipping upgrade since openssl 0.9.8k_0 >= openssl 0.9.8k_0, even though installed variants "" do not match "+darwin". Use 'upgrade --enforce-variants' to switch to the requested variants.
    Warning: Skipping upgrade since readline 6.0.000_1 >= readline 6.0.000_1, even though installed variants "" do not match "+darwin". Use 'upgrade --enforce-variants' to switch to the requested variants.
    --->  Computing dependencies for py26-psycopg2
    --->  Building python26
    Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.2" && /usr/bin/make all MAKE="/usr/bin/make CC=/usr/bin/gcc-4.0" " returned error 2
    Command output: /usr/bin/install -c -d -m 755 Python.framework/Versions/2.6
    if test ""; then \
            /usr/bin/gcc-4.0 -o Python.framework/Versions/2.6/Python  -dynamiclib \
                    -isysroot "" \
                    -all_load libpython2.6.a -Wl,-single_module \
                    -install_name /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python \
                    -compatibility_version 2.6 \
                    -current_version 2.6; \
            else \
            /usr/bin/libtool -o Python.framework/Versions/2.6/Python -dynamic  libpython2.6.a \
                     -lSystem -lSystemStubs -install_name /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python -compatibility_version 2.6 -current_version 2.6 ;\
    fi
    ld64 failed: in libpython2.6.a(__.SYMDEF), not a valid ppc64 mach-o file
    /usr/bin/libtool: internal link edit command failed
    make: *** [Python.framework/Versions/2.6/Python] Error 1

    Error: The following dependencies failed to build: python26
    Error: Status 1 encountered during processing.

FYI, the python i installed was the dmg file from the pythong site.

Thanks, Wenbert

+8  A: 

If you're using Python 2.6, you actually want to build py26-psycopg2:

$ sudo port install py26-psycopg2

In MacPorts, py-* packages build using Python 2.4, py25-* using Python 2.5, and py26-* use Python 2.6.

mipadi
This is the correct answer. Also, it is worth to point out that you must upgrade your Xcode to version 2.5
wenbert
+3  A: 

Maybe you need to look at the version for Python 2.6?

jgeewax
A: 

I installed psycopg2 on my Mac with setuptools and easy_install. First get the Python 2.6 egg from the setuptools downloads page, then install it with the instructions on that page. Then you can run the following to install it:

sudo easy_install psycopg2

You may have different luck, but that's what did it for me.

Rudd Zwolinski
+1  A: 

I had problems installing psycopg2 on my 10.4 Mac too. I installed both Python and Postgres from dmg files, and sudo easy_install psycopg2 was giving an error I can't remember now. What worked for me was an easy solution:

PATH=$PATH:/Library/PostgreSQL/8.3/bin/ sudo easy_install psycopg2

which I've found at http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/

Maciej Konieczny
Yeah! Thanks a lot, that solved it for me.
jellybean
A: 

I tried everything and nothing works. At least this post: http://benkreeger.com/post/312303245/conquering-symbol-not-found-pqbackendpid

led me to homebrew which made it perfectly.

c0se