Cannot install library without lxml being installed first

Issue #11 resolved
Sebastian Rahlf
repo owner created an issue

Trying to install python-amazon-product-api in a clean site-packages directory (i.e. no lxml) results in



Traceback (most recent call last): File "<string>", line 1, in <module> File "", line 54, in <module> from lxml import objectify ImportError: No module named lxml }}}

because {{{}}} tries to use {{{amazonproduct.version}}} for which it needs to import that module first.

Comments (8)

  1. Sebastian Rahlf reporter

    There are two solutions to remedy this problem:

    1. Hardcode the version number in
    2. Turn the module into a package (i.e. -> amazonproduct/
  2. Anonymous

    I'd really love to see this fixed; so far I've just been installing lxml first via pip when necessary.

  3. Vladimir Sanchez

    I just had the same issue while instantiating and API() class. It barfed with:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/sandbox/local/lib/python2.7/site-packages/amazonproduct/", line 142, in __init__
        self.response_processor = processor or LxmlObjectifyProcessor()
      File "/sandbox/local/lib/python2.7/site-packages/amazonproduct/", line 24, in __init__
    from lxml import etree, objectify
    ImportError: No module named lxml

    I tried installing lxml in virtualenv and it was a pain due to missing header files and such. Have you had any such experiences ?

    Will appreciate any feedback.

  4. nhinkle

    I got this problem too, using version 2.6 of your API. The problem seems to be related to operating in a virtualenv. What you need to do is install libxml2-dev and libxslt-dev (using for example apt-get or similar), then do pip install lxml in your virtualenv. See this stack overflow post for some relevant details that helped me figure this out.

  5. Log in to comment