After I finally got lxml installed on my computer by downloading the .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/, I thought my lxml installation problems were behind me. But, clearly I was very wrong. It does not seem to be any easier on the EC2 platform. I have tried just about every command I can think of—sudo pip3/pip3.4/pip-3.4/easy_install-3.4 lxml/lxml-3.5.0-cp34-none-win32.whl/lxml-3.5.0-cp34-none-win32.whl, STATIC_DEPS=true sudo pip3/pip3.4/pip-3.4/easyinstall-3.4 install lxml. I keep getting the Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? error message.
I have tried to install these libraries too, but so far not successfully. Any help with installing either lxml or the dependent libraries would be greatly appreciated.
1 Answers
I was eventually able to install libxml2 by executing the following procedure:
Download the tar.gz. file from http://www.linuxfromscratch.org/blfs/view/7.7/general/libxml2.html, transfer it to the EC2 instance, and run tar -zxvf libxml2-2.9.2.tar.gz from the directory in which the file is located.
Run sudo yum install libxml2-devel libxslt-devel python34-devel. (The reason why I was unable to install these packages at first was that I used the omnipresent “-dev” wording, which did not work in this particular setup.)
From the libxml2-2.9.2 folder (as per the instructions at http://www.linuxfromscratch.org/blfs/view/7.7/general/libxml2.html) run
sed \
-e /xmlInitializeCatalog/d \
-e 's/((ent->checked =.*&&/(((ent->checked == 0) ||\
((ent->children == NULL) \&\& (ctxt->options \& XML_PARSE_NOENT))) \&\&/' \
-i parser.c
,
./configure --prefix=/usr --disable-static --with-history --with-python=/usr/bin/python3 && make
, and
make install
Then . . . , when I finally ran sudo easy_install-3.4 lxml, guess what . . . ; yes, the instance ran out of memory. So, I had to apply the following fix from How do you add swap to an EC2 instance?:
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
After that, it took quite a while to install using sudo easy_install-3.4 lxml, but it worked.