38

I have a perplexing problem. I have used mac version 10.9, anaconda 3.4.1, python 2.7.6.

Developing web application with python-amazon-product-api. i have overcome an obstacle about installing lxml, referencing clang error: unknown argument: '-mno-fused-madd' (python package installation failure).

But another runtime error happened. Here is the output from webbrowser.

Exception Type: ImportError Exception Value: dlopen(/Users/User_Name/Documents/App_Name/lib/python2.7/site-packages/lxml/etree.so, 2): Library not loaded: libxml2.2.dylib Referenced from: /Users/User_Name/Documents/App_Name/lib/python2.7/site-packages/lxml/etree.so Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0 

I'm not sure how to proceed and have searched here and elsewhere for this particular error.

1
  • I found a solution. I removed virtualenv's library setting. I reinstalled app-required libraries in local ID's python path. Not used virtualenv's setting. Inconvenient but the problem was solved. Commented Apr 20, 2014 at 12:23

6 Answers 6

102

This worked for me:

brew install libxml2 brew install libxslt brew link libxml2 --force brew link libxslt --force 
Sign up to request clarification or add additional context in comments.

4 Comments

Homebrew was the only way that worked for me. Tried all the other suggestions but no good.
Instead of brew link libxml2 --force, you can run echo /usr/local/opt/libxml2/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/libxml2.pth.
3rd or 4th time I've needed this, months apart each time. Wish I could upvote 3-4 times haha. Thanks!
This worked for me and saved me so much time debugging. THANK YOU!
42

If using conda, force a reinstall of lxml:

$ conda install -f lxml

Note that forcing a reinstall may have unforeseen consequences.

I first tried conda update lxml to no effect.

Then tried conda install lxml also to no effect (but that was a while ago and ymmv -- see comment).

1 Comment

'conda install lxml' worked for me (in my case, the '-f' option was not required)... the other answer below (conda install libxml2) did not work.
11

I was having this same issue. I realized that during pip install for my web app, lxml was attempting the following:

"Building against libxml2/libxslt in the following directory: /Users/[me]/anaconda/lib"

Not 100% sure why, but once I removed the anaconda/bin from my system path in bash_profile (anaconda sticks it in there when installing) I was able to pip install lxml correctly. After which you should be able to re-add anaconda/bin to your system path without issue.

Comments

8

I get this to work by doing the following:

conda install libxml2 

Comments

0

Consider using an alternative channel in conda.

$ anaconda search -t conda pyquery Using anaconda-server api site https://api.anaconda.org Run 'anaconda show <USER/PACKAGE>' to get more details: Packages: Name | Version | Package Types | Platforms ------------------------- | ------ | --------------- | --------------- CS109/pyquery | 1.2.9 | conda | linux-64, win-32, win-64, linux-32, osx-64 : A jquery-like library for python asmeurer/pyquery | 1.2.6 | conda | osx-64 : https://github.com/gawel/pyquery auto/pyquery | 1.2.8 | conda | linux-64, linux-32, osx-64 : https://github.com/gawel/pyquery dan_blanchard/pyquery | 1.2.6 | conda | linux-64 : https://github.com/gawel/pyquery hargup/pyquery | | conda | None-None, linux-64 : A jquery-like library for python meloncholy/pyquery | 1.2.9 | conda | linux-64 : A jquery-like library for python mhworth/pyquery | 1.2.8 | conda | linux-64, osx-64 : A jquery-like library for python nbsantos/pyquery | 1.2.9 | conda | osx-64 : A jquery-like library for python pdrops/pyquery | 1.2.8 | conda | linux-64, osx-64 : A jquery-like library for python ziebel/pyquery | 1.2.9 | conda | linux-64 : A jquery-like library for python Found 10 packages 

Then, picking a channel, do:

conda install pyquery -c CS109 

Comments

0

I tried almost all approaches above and failed. What worked for me was commenting out the

export DYLD_LIBRARY_PATH=/usr/lib 

in my bash profile. This line is added by the anaconda installer automatically.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.