views:

449

answers:

2

Hi,

My app needs to use PyCurl, so i tried to install it on my Mac but i found a lot of problems and error :(

Requirement: First of all i've to say that the version of Python working on my Mac is 32 bit based, because i need to use WxPython, that needs 32 bit Python. For doing this i used:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

To install PyCurl i used:

sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl

And the terminal returned:

Best match: setuptools 0.6c11
Processing setuptools-0.6c11-py2.6.egg
setuptools 0.6c11 is already the active version in easy-install.pth
Installing easy_install script to /usr/local/bin
Installing easy_install-2.6 script to /usr/local/bin

Using /Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependencies for setuptools
Finished processing dependencies for setuptools
Searching for pycurl
Best match: pycurl 7.16.2.1
Processing pycurl-7.16.2.1-py2.6-macosx-10.6-universal.egg
pycurl 7.16.2.1 is already the active version in easy-install.pth

Using /Library/Python/2.6/site-packages/pycurl-7.16.2.1-py2.6-macosx-10.6-universal.egg
Processing dependencies for pycurl
Finished processing dependencies for pycurl

so i thought that pycurl was correctly installed and working. But...

But when i started my app, python return me an error:

python /Users/lorenzodenobili/Desktop/Python/AGGIORNATORE_PY/Dropbox/wxPython/test.py  
Traceback (most recent call last):  
  File  "/Users/lorenzodenobili/Desktop/Python/AGGIORNATORE_PY/Dropbox/wxPython/test.py", line 20, in <module>  
    import pycurl  
  File "build/bdist.macosx-10.6-universal/egg/pycurl.py", line 7, in <module>  
  File "build/bdist.macosx-10.6-universal/egg/pycurl.py", line 6, in __bootstrap__  
ImportError: dlopen(/Users/lorenzodenobili/.python-eggs/pycurl-7.16.2.1-py2.6-macosx-10.6-universal.egg-tmp/pycurl.so,  2): no suitable image found.  Did find:  
    /Users/lorenzodenobili/.python-eggs/pycurl-7.16.2.1-py2.6-macosx-10.6-universal.egg-tmp/pycurl.so: mach-o, but wrong architecture  

Yep, there is something quite big that goes wrong.

I really don't have any idea on how to solve this error, so i really need your help!

thank you so much!!

+1  A: 

You passed the following flags to the compiler when compiling PyCurl:

ARCHFLAGS="-arch x86_64"

It seems that you have compiled PyCurl in 64-bit mode, while you use the 32-bit Python. Have you tried it with ARCHFLAGS="-arch i386"?

Tamás
nothing of new happens.. the entire error in the reply!
Ldn
Strangely enough, it works for me, I have just tried it. The only difference between your configuration and mine is that I have `libcurl 7.19.7`, while you seem to have `7.20.0`. The latter might be incompatible with `pycurl`, which has a version number of `7.19.0`. Have you installed `curl` from a third-party source? OS X Snow Leopard seems to include it by default and I use that.
Tamás
A: 

iMac:pycurl-7.19.0 lorenzodenobili$ sudo env ARCHFLAGS="-arch i386" easy_install setuptools pycurl Searching for setuptools Best match: setuptools 0.6c11 Processing setuptools-0.6c11-py2.6.egg setuptools 0.6c11 is already the active version in easy-install.pth Installing easy_install script to /usr/local/bin Installing easy_install-2.6 script to /usr/local/bin

Using /Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg Processing dependencies for setuptools Finished processing dependencies for setuptools Searching for pycurl Reading http://pypi.python.org/simple/pycurl/ Reading http://pycurl.sourceforge.net/ Reading http://pycurl.sourceforge.net/download/ Best match: pycurl 7.19.0 Downloading http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz Processing pycurl-7.19.0.tar.gz Running pycurl-7.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-tpClDx/pycurl-7.19.0/egg-dist-tmp-bGXtsd Using curl-config (libcurl 7.20.0) In file included from /opt/local/include/curl/curl.h:36, from src/pycurl.c:50: /opt/local/include/curl/curlrules.h:144: error: size of array ‘curl_rule_01’ is negative /opt/local/include/curl/curlrules.h:154: error: size of array ‘curl_rule_02’ is negative error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1

Ldn