Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

python2 libxml2 module missing?

rouberol
Beginner
4,163 Views

Hi

On CentOS7.4 "system" python 2.7.5  loads libxml2 moddule, but not intel python2 from intelpython2-2018.2-037.x86_64 rpm

candid01: ~ > which python
/usr/bin/python
candid01: ~ > python --version
Python 2.7.5
candid01: ~ > python -c "import libxml2"

candid01: ~ > module purge
candid01: ~ > module load intelpython/2
candid01: ~ > which python
/opt/intel/intelpython2/bin/python
candid01: ~ > python --version
Python 2.7.14 :: Intel Corporation
candid01: ~ >  python -c "import libxml2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named libxml2

 

How can I add libxml2 module to my intel python installation ?

Regards

sr

 

 

 

0 Kudos
2 Replies
Rohit_J_Intel
Employee
4,163 Views
Hi Rouberol,
 
We ship native library of libxml2 since many Python modules depend on it. I suppose you're looking for Python bindings of the library. We don't ship Python bindings; you can get it in one of two ways:
1. You can pip install lxml, #(documentation here - http://lxml.de/) or
2. You can build the Python bindings using instructions give here http://xmlsoft.org/python.html
 
Thanks,
Rohit
0 Kudos
rouberol
Beginner
4,163 Views

Hi Rohit

thanks for your pointers

Regards,

sr

For anyone interested, this is what I did:

# We build libxml2, same version as in libxml2 rpm, only to get libxml2 python binding for Intel python

LIBXML2VER=2.9.1

cd /scratch
wget ftp://xmlsoft.org/libxml2/libxml2-$LIBXML2VER.tar.gz
tar xf libxml2-$LIBXML2VER.tar.gz 
cd libxml2-$LIBXML2VER/
./configure --prefix=/scratch/gg --with-python=/opt/intel/intelpython2/
make
make install
cd /scratch
rm -rf gg libxml2-$LIBXML2VER.tar.gz libxml2-$LIBXML2VER

# files installed:
[root@cmaster /scratch]# find /opt/intel/intelpython2/ -mmin -2
/opt/intel/intelpython2/lib/python2.7/site-packages
/opt/intel/intelpython2/lib/python2.7/site-packages/libxml2mod.a
/opt/intel/intelpython2/lib/python2.7/site-packages/libxml2mod.so
/opt/intel/intelpython2/lib/python2.7/site-packages/libxml2.py
/opt/intel/intelpython2/lib/python2.7/site-packages/drv_libxml2.py
/opt/intel/intelpython2/lib/python2.7/site-packages/libxml2mod.la

# test:
~ > module purge
~ > module load intelpython/2
~ > python -c "import libxml2"
~ > 

0 Kudos
Reply