lxml runtime error: Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0 lxml runtime error: Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0 python python

lxml runtime error: Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0


This worked for me:

brew install libxml2brew install libxsltbrew link libxml2 --forcebrew link libxslt --force


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).


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.