1

I want to use lxml python library. I installed it with pip tool on python2.7

pip install lxml

when I open python shell interpreter and write

>>> from lxml import objectify
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name objectify

this exception is raised. I also tried to install older versions 3.2, 2.2.8 but the same problem rises. don't know what to do

amr.negm
  • 183
  • 1
  • 13

2 Answers2

2

Use easy_install

easy_install lxml

>>> from lxml import objectify

Chris
  • 470
  • 4
  • 11
  • I love how (re)installing lxml still fixes this issue, 8 years later. – Sander Koldenhof Jul 01 '20 at 08:38
  • How will the same work on AWS Glue? I've given this wheel file as path: lxml-4.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl. Its downloading but failing in "from lxml import objectify" part. Can't install manually inside a managed service like Glue, any help? – Aakash Basu May 18 '22 at 21:48
0

From PyCharm you can install lxml 3.4.2 and it works.

Sklavit
  • 2,225
  • 23
  • 29