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 7692209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:48:01+00:00 2026-05-31T20:48:01+00:00

First, I installed lxml without using pip (Python 2.7.2 on Mac OS 10.6.8). Then,

  • 0

First, I installed lxml without using pip (Python 2.7.2 on Mac OS 10.6.8). Then, I read this post and I installed it again using pip (sudo pip install lxml). I still had a problem:

I can import lxml (import lxml) but I cannot use from lxml import etree. I have this error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.6-intel.egg/lxml/etree.so, 2): Symbol not found: _htmlParseChunk
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.6-intel.egg/lxml/etree.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml-2.3.3-py2.7-macosx-10.6-intel.egg/lxml/etree.so

Then, I tried to install lxml from source following these instructions, and I have this error message:

checking whether we are cross compiling... configure: error: in `/Users/my_name/Applications/lxml/lxml-2.2.2/build/tmp/libxml2-2.7.8':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Traceback (most recent call last):
  File "setup.py", line 115, in <module>
    STATIC_CFLAGS, STATIC_BINARIES),
  File "/Users/my_name/Applications/lxml/lxml-2.2.2/setupinfo.py", line 50, in ext_modules
    libxslt_version=OPTION_LIBXSLT_VERSION)
  File "/Users/my_name/Applications/lxml/lxml-2.2.2/buildlibxml.py", line 198, in build_libxml2xslt
    call_subprocess(configure_cmd, cwd=libxml2_dir, **call_setup)
  File "/Users/my_name/Applications/lxml/lxml-2.2.2/buildlibxml.py", line 158, in call_subprocess
    raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Exception: Command "./configure --without-python --disable-dependency-tracking --disable-shared --prefix=/Users/my_name/Applications/lxml/lxml-2.2.2/build/tmp/libxml2" returned code 1

Finally, I followed the second advise of this answer and I used the command line sudo STATIC_DEPS=true /usr/bin/easy_install-2.7 lxml. It installed lxml on the Apple-supplied system Python 2.7, and not on the version I’m currently using. The positive point: if I run the Apple-Python, I can from lxml import etree.

Negative point: I still don’t know how to install lxml on another version of python. Any idea?

I’m currently using /Library/Frameworks/Python.framework/Versions/2.7/bin/python.

  • 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-31T20:48:02+00:00Added an answer on May 31, 2026 at 8:48 pm

    You need to install a separate easy_install for the version of Python you are using. See the answer here for more details. Then you can run the easy_install command using it:

    STATIC_DEPS=true easy_install-2.7 lxml
    

    UPDATE: From your comments, you now are reporting a permission error showing yet another Python path, one that appears to be a MacPorts-installed Python: /opt/local/Library/Frameworks. You need to figure out which Python you want to use. If, in fact, you want to use the MacPorts one, then simply install the MacPorts-provided lxml port. That’s the easiest solution.

    $ sudo port selfupdate
    $ sudo port install py27-lxml
    

    Otherwise, you need to install easy_install with the other (python.org?) Python 2.7.2. I would recommend to use Distribute, the more modern fork of `setuptools’ and you need to ensure you are using the right Python:

    $ curl -O http://python-distribute.org/distribute_setup.py
    $ export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
    $ which python2.7   # should be in the path above
    $ python2.7 distribute_setup.py
    $ STATIC_DEPS=true easy_install-2.7 lxml
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just installed the first release candidate of Python 3.0 and got this error
I installed igraph for python in my mac but I can't import it. First
I had TSVN installed first and been using for a long time. Then I
I have just installed boost for the first time on my Intel Mac, and
When I installed perl from the source the first nice surprise was that without
I first installed Macports so it would be easier. Then installed mysql5,mysql5-server and py26-mysql.
When Python is first installed, the default setting executes users' code input line-by-line. But
I am using Netbeans 6.7. I had first installed Java 1.5 before installing Netbeans.
I have installed Python 2.6.6 on CentOS 5.4, [@SC-055 lxml-2.3beta1]$ python Python 2.6.6 (r266:84292,
I found this pretty weird thing when I first installed SQL Server 2008, for

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.