Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 631443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:57:56+00:00 2026-05-13T19:57:56+00:00

i’m having a hell of a time installing scrapy on my sl mbp. it

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:57:56+00:00Added an answer on May 13, 2026 at 7:57 pm

    From the paths in your traceback, it appears you have installed and are trying to use the python.org python 2.6.4 (installed to /Library/Frameworks/Python.frameworks …). That python is 32-bit only. By default on 10.6, MacPorts tries to install 64-bit versions of packages. You can change that for most MacPorts packages by specfying the +universal variant on your MacPorts install commands or by adding it to /opt/local/etc/macports/variants.conf. But, since you need a variety of packages, if you just need this for your own machine you’ll likely find it much easier to just install a complete python2.6 64-bit solution using MacPorts. Other than scrapy itself, you should find nearly all of the packages you need already there. You’ll need to modify your $PATH to add /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin and /opt/local/bin before any other directories with Python in them. Something like this should work (untested!):

    sudo port selfupdate  # ensure you have the latest ports file information
    sudo port install py26-libxml2 py26-twisted py26-openssl py26-simplejson py26-setuptools python_select
    sudo python_select python26  # optionally make /opt/local/bin/python -> python2.6
    sudo /opt/local/bin/easy_install-2.6 scrapy
    # or install manually
    cd /path/to/scrapy
    sudo /opt/local/bin/python2.6 setup.py install
    

    EDIT: For 10.6, due to some issues with lack of Tk support in 64-bit mode, Tk defaults to the X11 version which you probably neither want nor need. I add the following variants to /opt/local/etc/macports/variants.conf for 10.6 (not all of them are applicable to python and friends):

    +bash_completion +quartz +ssl +no_x11 +no_neon +no_tkinter +universal +libyaml -scientific
    

    EDIT: If MacPorts is installed properly, you should see something like this on 10.6:

    $ ls -l /opt/local/bin/python2.6
    lrwxr-xr-x  1 root  wheel  73 Oct 28 20:25 /opt/local/bin/python2.6@ -> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
    $ file /opt/local/bin/python2.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
    

    That’s if you’ve added the +universal variant, otherwise you may just see a single x86_64 or i386 architecture.

    When using relative paths, make sure your shell $PATH has the two MacPorts directories first:

    $ echo $PATH
    /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin ...
    

    You may need to edit your ~/.bash_profile or other shell file to make that change “permanent”. If you want the bare python command to refer to the MacPorts Python, make sure to run the python_select command shown above. If you are still having problems, a nice thing about MacPorts is it is easy to delete and start over again; just:

    $ sudo rm -r /opt/local
    

    and download the MacPorts 10.6 installer. But you really shouldn’t have to do that. And I think it would really be in your best interests to get this fixed and working as it will likely save you lots of headaches in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.