If “pip” installed 64-bit libraries, while python is a 32-bit binary, “pkg” might stop working with the following error messages:
ImportError: ld.so.1: bootadm: fatal: /usr/lib/python2.7/site-packages/lxml/etree.so: wrong ELF class: ELFCLASS64
ImportError: ld.so.1: python2.7: fatal: /usr/lib/python2.7/site-packages/_cffi_backend.so: wrong ELF class: ELFCLASS64
$ file `which python` /usr/bin/python: ELF 32-bit LSB executable 80386 Version 1 [SSE], dynamically linked, not stripped
The workaround is to remove the corresponding python packages (in this case cffi and lxml), download and recompile them manually with “-m32”:
$ export CFLAGS="-m32"