Reputation: 125
I am trying to run python-docx in Enthought Canopy. I'm running Ubuntu 14.04 on VMWare Worstation 10. Whenever I try to import docx or import etree from lxml, I get an error that seems to be related to the libxml2 library:
ImportError: /usr/lib/x86_64-linux-gnu/libxslt.so.1: symbol xmlBufUse, version LIBXML2_2.9.0 not defined in file libxml2.so.2 with link time reference
I checked around, and found another person with a similar error, and I followed the directions. Still no luck. Then I realized that I have libxml2 version 2.9.1 on my computer.
Does this mean that I need to get the older 2.9.0 version of libxml2, or is something else going on? I can find 2.9.1 with apt-get, but not 2.9.0. Before setting off on that path, I figured someone here might have a better idea.
Thanks!
Upvotes: 7
Views: 6736
Reputation: 196
Just install below package.
For Ubuntu
apt-get install libxslt-dev
For Centos
yum install libxslt-devel
Upvotes: 11
Reputation: 28893
I don't have much expertise with Ubuntu, but this problem is definitely between lxml and libxml2 and/or libxslt. The only reason it's happening when running python-docx is because that causes lxml to be imported.
I would try uninstalling lxml and reinstalling. I vaguely remember lxml hard-linking with libxml2 and libxslt, but that was a while ago. It's plausible there's a version mis-match between what lxml linked with and the installed versions.
If that didn't do the trick I'd look deeper at the libxml2 and libxslt install. There's some popular advice on that here: How to install lxml on Ubuntu
python-docx isn't going to be terrifically picky about having the very latest lxml package, if there's one you can get with apt it should work just fine.
Upvotes: 1