Regarding the lxml import error only in a web-request

Discussion in 'Python' started by nagraj, Mar 20, 2009.

  1. nagraj

    nagraj Guest

    I'm trying to run Django from Apache using FastCGI in a shared hosting
    environment on DH. I've installed python 2.5.2 onto my home
    environment. And all the necessary libraries including lxml 2.1.3,
    libxml2, libxslt, flup, etc.


    I'm facing a strange issue with lxml, which occurs only when it is
    used from the webrequests. I'm getting the following error:


    Exception Type: ImportError
    Exception Value: ~/opt/lib/python2.5/site-packages/lxml-2.1.3-
    py2.5-linux-x86_64.egg/lxml/etree.so: undefined
    symbol:xmlSchematronSetValidStructuredErrors


    it basically comes when i'm trying to do this in my Django views.py
    from lxml import etree


    But the same is running perfectly well in my python console. Even with
    the following command it works well
    python -c "from lxml import etree"


    I've almost checked every installation and library paths.. not able to
    figure out what exactly would be the issue.


    Please help me.
    Nagraj.
     
    nagraj, Mar 20, 2009
    #1
    1. Advertising

  2. nagraj wrote:
    > I'm trying to run Django from Apache using FastCGI in a shared hosting
    > environment on DH. I've installed python 2.5.2 onto my home
    > environment. And all the necessary libraries including lxml 2.1.3,
    > libxml2, libxslt, flup, etc.
    >
    >
    > I'm facing a strange issue with lxml, which occurs only when it is
    > used from the webrequests. I'm getting the following error:
    >
    >
    > Exception Type: ImportError
    > Exception Value: ~/opt/lib/python2.5/site-packages/lxml-2.1.3-
    > py2.5-linux-x86_64.egg/lxml/etree.so: undefined
    > symbol:xmlSchematronSetValidStructuredErrors
    >
    >
    > it basically comes when i'm trying to do this in my Django views.py
    > from lxml import etree
    >
    >
    > But the same is running perfectly well in my python console. Even with
    > the following command it works well
    > python -c "from lxml import etree"
    >
    >
    > I've almost checked every installation and library paths.. not able to
    > figure out what exactly would be the issue.


    You most likely have an (older) system library of libxml2 and/or libxslt
    installed. Try to use those *instead* of installing libxml2/libxslt
    separately, or build lxml with the "--auto-rpath" option to make it
    remember the path where the libraries were installed when it was compiled.

    BTW, you do not need the Python bindings for those two libraries installed,
    in case you are confusing the libxml2/libxslt Python modules with the
    libxml2/libxslt libraries (which happens quite often).

    Stefan
     
    Stefan Behnel, Mar 20, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    2
    Views:
    2,041
    John Saunders
    Oct 16, 2003
  2. ABC
    Replies:
    7
    Views:
    694
    Luke Dalessandro
    Jan 13, 2006
  3. KLEIN Stéphane
    Replies:
    1
    Views:
    395
    Stefan Behnel
    Aug 25, 2008
  4. Owen Zhang

    lxml build error in sun

    Owen Zhang, Sep 12, 2008, in forum: Python
    Replies:
    1
    Views:
    374
    Stefan Behnel
    Sep 13, 2008
  5. TheIvIaxx
    Replies:
    1
    Views:
    1,566
    TheIvIaxx
    Dec 11, 2008
Loading...

Share This Page