Code Monkey home page Code Monkey logo

Comments (18)

acdha avatar acdha commented on August 19, 2024

This doesn't reproduce with newer versions of lxml - if possible, it'd be good to test with at least 2.3.6 but it appears that simply using a newer version of Cython during compilation might be sufficient based on this compatibility fix which they made about six months ago:

http://comments.gmane.org/gmane.comp.python.cython.user/7190
cython/cython@a8f70e2

Chris

from pysolr.

srusskih avatar srusskih commented on August 19, 2024

lxml was built without cython. and I have same problems with lxml-2.3.6
Works well with lxml-3.0

from pysolr.

acdha avatar acdha commented on August 19, 2024

lxml 2.3 appears to ship with sources compiled using Cython 0.14. It looks like you will need to either switch to lxml 3.0 or install Cython 0.17 or later before installing lxml 2.3.x:

$ git tag --contains a8f70e2210b9a36c3b67ce5f426000c62473b62e
0.17
0.17.1
0.17.4
0.17b4
0.18

If lxml 2.x is still supported it might be worth creating an issue on lxml for an upstream release using a version of Cython which is fully compatible with Python 2.6+ and unicode_literals.

Chris

from pysolr.

srusskih avatar srusskih commented on August 19, 2024

Thanks. I have found the solution (change lxml version).

from pysolr.

stugots avatar stugots commented on August 19, 2024

We just ran into this. Is lxml version xxxxxx specified as a dependency by pysolr? I.e., when pysolr installs, does it look for lxml>=3.x.y?

from pysolr.

acdha avatar acdha commented on August 19, 2024

@stugots Not by default – it's optional and only used for parsing Tomcat error messages so we don't want to install it everywhere. I updated the extras_require stanza but you'll need to use the extras syntax to install – e.g. pip install pysolr[tomcat]==3.0.6. See http://pythonhosted.org/distribute/setuptools.html#declaring-dependencies for more information.

from pysolr.

xudonax avatar xudonax commented on August 19, 2024

This seems to be back in the latest GIT revision of django-haystack... The traceback seems to indicate that the error is in lxml, but there is practically no way to do this on Ubuntu 12.10. I tried the "patch" above and this seems to work.

Traceback (most recent call last):
  File "/home/patrick/spng/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/home/patrick/spng/lib/python2.7/site-packages/django/db/transaction.py", line 223, in inner
    return func(*args, **kwargs)
  File "/home/patrick/spng/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/patrick/spng/src/internship/views.py", line 248, in register_step_4
    person.save()
  File "/home/patrick/spng/src/person/models.py", line 128, in save
    self.update_solr()
  File "/home/patrick/spng/src/person/models.py", line 135, in update_solr
    InternIndex().update_object(self.intern)
  File "/home/patrick/spng/src/haystack/indexes.py", line 266, in update_object
    self._get_backend(using).update(self, [instance])
  File "/home/patrick/spng/src/haystack/backends/solr_backend.py", line 66, in update
    self.conn.add(docs, commit=commit, boost=index.get_field_weights())
  File "/home/patrick/spng/lib/python2.7/site-packages/pysolr.py", line 740, in add
    message.append(self._build_doc(doc, boost=boost))
  File "/home/patrick/spng/lib/python2.7/site-packages/pysolr.py", line 695, in _build_doc
    field = ET.Element('field', **attrs)
  File "lxml.etree.pyx", line 2560, in lxml.etree.Element (src/lxml/lxml.etree.c:52924)
TypeError: Element() keywords must be strings

from pysolr.

acdha avatar acdha commented on August 19, 2024

@xudonax Did you try upgrading to lxml 3? It's a clean install on Ubuntu.

from pysolr.

xudonax avatar xudonax commented on August 19, 2024

I couldn't update lxml in any way. apt-get update && apt-get upgrade didn't give me any upgrades. Then again, I'm still on 12.10, I guess I can wait a little while and check it out on Ubuntu 13.04 which should be released any day now.

from pysolr.

acdha avatar acdha commented on August 19, 2024

@xudonax Ubuntu won't ship an updated lxml system package but you can install lxml 3 along with everything else from PyPI inside a virtualenv – I've run it on 12.04 servers that way for awhile.

from pysolr.

xudonax avatar xudonax commented on August 19, 2024

I got an gcc compilation error. I'll take a look at dependencies tomorrow. So far I installed only libxml-dev AFAIK, because it couldn't find python-dev...

from pysolr.

alex-dow avatar alex-dow commented on August 19, 2024

I get the same issue. Using lxml 3.2.0 pysolr 3.0.6

from pysolr.

Brant avatar Brant commented on August 19, 2024

I was running into this issue. The following setup worked for me:
Python 2.7.4
pysolr 3.0.6
lxml 3.2.1

from pysolr.

shibz avatar shibz commented on August 19, 2024

I had this issue, but fixed it by changing to lxml 3.0.2. I'm using pysolr 3.0.6.

from pysolr.

t2y avatar t2y commented on August 19, 2024

I had the same issue.
Python 2.7.3
pysolr 3.1.0 (02e7b65)
lxml 2.3.2

It works for me after upgrading lxml 2.3.2 to 3.2.4.

from pysolr.

acdha avatar acdha commented on August 19, 2024

@toastdriven Think it's worth making our lxml check do something like issue a warning and fallback to stdlib if lxml is present but <3.x?

from pysolr.

tisto avatar tisto commented on August 19, 2024

I just ran into that issue (from 2013?). Wouldn't it be better to make pysolr require a certain lxml version in its setup.py to avoid problems like this?

from pysolr.

acdha avatar acdha commented on August 19, 2024

@tisto The problem was that people had other versions of lxml in their projects & it'd conflict for something which is only relevant to a subset of users. My preferred approach is the one from #133 (comment) where we simply drop lxml entirely since it's only used for error handling. I just wrapped that code into #149 for easier testing / commenting.

from pysolr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.