views:

586

answers:

2

I'm running python 2.6 on an Intel Mac OS X 10.5

I'm trying to install pycurl 7.16.2.1 (as recommended here http://curl.haxx.se/mail/curlpython-2009-03/0009.html), but for some reason, the installation sees my libcurl 7.16.3, yet it still insist I install 7.16.2 or greater (doesn't 7.16.3 satisfy that?)

Here's the error output:

Running pycurl-7.16.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-3emZIB/pycurl-7.16.2.1/egg-dist-tmp-K10rbP
Using curl-config (libcurl 7.16.3)
src/pycurl.c:54:4:src/pycurl.c:54:4: error: #error "Need libcurl version 7.16.2 or greater to compile pycurl."
 error: #error "Need libcurl version 7.16.2 or greater to compile pycurl."

To be certain curl-config --version yields libcurl 7.16.3

Any advice? Should I upgrade libcurl, or stick with the factory default lib?

== added more details after response ==

AFAIK the python I have is factory default (I didn't get it myself from python.org)

Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) 
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin

And this is my curl version. Looks misleading because I'm using an Intel Macbook, not PPC.

curl 7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
Protocols: tftp ftp telnet dict ldap http file https ftps 
Features: GSS-Negotiate IPv6 Largefile NTLM SSL libz 

I'll take whichever pycurl works with my existing python interpreter

I do have ports:

sudo port -u install py26-pycurl
Error: Port py26-pycurl not found
+2  A: 

If you are using the python.org Python 2.6, it is built using the 10.4 SDK so as to be able to run on multiple versions of OS X. In that case, the pycurl build is likely trying to link against the 10.4 version of libcurl, which appears to be 7.13.1. The thread you link to is talking about using the 10.5 Apple-supplied Python 2.5 which is built using 10.5 libraries and, with that, pycurl 7.16.2.1 does seem to build and install correctly.

You can try to manually install pycurl; there is a documented --curl-config argument to its setup.py which allows you to specify the path to the curl-config to use. Unfortunately, that does not seem to work with /usr/bin/curl-config; the proper include files directories are not being added. Short of hacking the setup.py file, a better approach is to install a newer libcurl and use the latest pycurl. The easiest way to do that is to use MacPorts. Even easier is to install pycurl and python2.6 from MacPorts. If you don't already use MacPorts, download and install the base files. Then:

sudo port selfupdate
sudo port -u install py26-curl   #edited

The MacPorts python2.6 will be at /opt/local/bin/python2.6.

If you'd rather stick with the python2.6 you've installed, install the curl package:

sudo port selfupdate
sudo port -u install curl

Then manually install pycurl using something like:

curl http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz | tar xz
cd pycurl-7.19.0
python2.6 setup.py install --curl-config=/opt/local/bin/curl-config
Ned Deily
Hi Ned,Not enough space to add here, I've added my answer back on the question above
Jay
Where to begin? You said you are running on 10.5. Apple ships Python 2.5 (and 2.3) with 10.5. On 10.6, Apple ships 2.6.1. So 2.6.2 is definitely not the factory default. Try `which python2.6` to find out where it is installed. My apologies: the MacPorts package name is `py26-curl`, not `py26-pycurl`; I've edited the answer accordingly. And if you have curl 7.16.3, that's not the standard curl. Chances are you have an older MacPorts version of curl and python26 already installed. Before you do anything else, try updating it with: `sudo port selfupdate ; sudo port -u upgrade outdated`.
Ned Deily
That was it! I upgraded macports, used macports to upgrade curl, and then easy_install installed pycurl. Thanks Ned!
Jay
Good to hear. BTW, to practice good Stack Overflow citizenship, you should either mark an answer as accepted or refine your question until you do get an acceptable answer.
Ned Deily
Sorry! I thought I couldn't mark an answer as right for the same reason why I can't vote (new user). Just did. Thanks again, Ned.
Jay
A: 

I got my pycurl from Sourceforge. Seems they'd have installable builds backwards and forwards that would match any "shipped with" Mac OS X configuration there is. I believe the URL is http://pycurl.sourceforge.net but don't quote me on that.

BZT

silversleevesx