i'm having a hell of a time installing scrapy on my sl mbp. it requires libxml2, so i set about installing that. installing it from macports doesn't seem to pull down the python binding.
installing it from source through scrapy's instructions (here) does install the python bindings, but when i run 'python -c "import libxml2"' i get an architecture mismatch:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "libxml2.py", line 1, in <module>
import libxml2mod
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- packages/libxml2mod.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- packages/libxml2mod.so: mach-o, but wrong architecture
when i explicitly build the libxml2 dlls to be 32bit, that error goes away, but then libxslt won't build because of some other library not being 32 bit. i'm afraid to keep pulling on that string. so the question is - is python 32bit only? am i doing something stupid here?
edit - this is python 2.6
edit 2 - by popular demand, i'm consolidating @Ned Deily's awesome answer up here. all credit to him, i'm just posting the steps i took based on his response:
if you've been screwing around with mac ports, (and haven't installed anything else through them that you need), nuke them.
$ sudo rm -r /opt/local
add the following to /opt/local/etc/macports/variants.conf
to prevent downloading the entire unix library with the next commands
+bash_completion +quartz +ssl +no_x11 +no_neon +no_tkinter +universal +libyaml -scientific
install the macports version of python
$ sudo port install python26
install the pre-reqs for scrapy
sudo port install py26-libxml2 py26-twisted py26-openssl py26-simplejson py26-setuptools python_select
sudo python_select python26
test that the correct python is selected: run $ which python
, which should say something along the lines of '/opt/local/bin/python', and that in its own right should be a link to /opt/local/bin/python2.6.
test that the correct architectures are present: run file 'which python'
(the single quotes should be backticks, which should spit out (for intel macs running 10.6):
/opt/local/bin/python2.6: Mach-O universal binary with 2 architectures
/opt/local/bin/python2.6 (for architecture x86_64): Mach-O 64-bit executable x86_64
/opt/local/bin/python2.6 (for architecture i386): Mach-O executable i386
test that libxml installed successfully
$ python -c 'import libxml2'
if all is well, you should get no output.
install scrapy
sudo /opt/local/bin/easy_install-2.6 scrapy
run through the streets (fully clothed) rejoicing that everything is done. again, thanks to ned for the detailed response.