Skip to content

COMPAT: Ignore numexpr <= v2 (at least for now) #5855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jtratner opened this issue Jan 5, 2014 · 29 comments · Fixed by #6109
Closed

COMPAT: Ignore numexpr <= v2 (at least for now) #5855

jtratner opened this issue Jan 5, 2014 · 29 comments · Fixed by #6109
Assignees
Labels
Compat pandas objects compatability with Numpy or Python functions
Milestone

Comments

@jtratner
Copy link
Contributor

jtratner commented Jan 5, 2014

Earlier versions of numexpr don't work with pandas because of API changes. For now we should not use numexpr if version too low and then revisit whether we can easily support it later.

@ghost
Copy link

ghost commented Jan 23, 2014

Also should raise warning when using query/eval that require numexpr. #5969.

@cpcloud
Copy link
Member

cpcloud commented Jan 23, 2014

Hm .. _check_engine should raise an ImportError if numexpr can't be imported

@cpcloud
Copy link
Member

cpcloud commented Jan 23, 2014

that's the second thing that happens when you call pd.eval. Let me try and repro #5969

@jreback
Copy link
Contributor

jreback commented Jan 23, 2014

@cpcloud let's create a sep issue for query/eval (and do a PR for 0.13.1)

@cpcloud
Copy link
Member

cpcloud commented Jan 23, 2014

you mean for #5969?

@jreback
Copy link
Contributor

jreback commented Jan 23, 2014

yep...I think #5969 got closed , but the non-installed numexpr was causing it (or can just reopen that one), and see if you can repro

@cpcloud
Copy link
Member

cpcloud commented Jan 23, 2014

ok repopening ...

@cpcloud
Copy link
Member

cpcloud commented Jan 23, 2014

Just as a note to self:

Somehow, without numexpr installed, eval plugs along until the AttributeError thrown by trying to call numexpr.evaluate is raised

@jreback
Copy link
Contributor

jreback commented Jan 24, 2014

@jtratner / @cpcloud going to be able to get to this?

@cpcloud
Copy link
Member

cpcloud commented Jan 24, 2014

i can do this weekend

@jtratner
Copy link
Contributor Author

Yes, just need to figure out why this one test fails.

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

@jtratner / @cpcloud hows this coming?

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

trying to repro now ...

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

@jreback So for frame/series ops check ne version and ignore it and for eval raise?

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

@jtratner Do you want me to take this?

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

I think just have to make _NUMEXPR_INSTALLED=False if the version is say < 2.0 (in compuatation/expressions.py, then a similar check in computation/eval.py where you try to import numexpr

so yes I would raise if you try to eval, but just falls back like for evaluate)

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

i don't think it should fall back for eval ... i think it should raise .. since that would make it use the python engine if the numexpr version is too low and the user will never know

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

oh i c ... that's wat u said .. .misread it

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

@cpcloud I wouldn't even attempt to use the Python eval...just raise the ImportError (for pd.eval/df.query)
no point....let's make it simple, I think @jtratner was trying to fall back, but not necessary (and for .evaluate in expressions, it already falls back gracefully).

In fact you can just import computation/expressions and use _NUMEXPR_INSTALLED and done

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

I can't repro @twiecki's issue ... tried with all past versions of numexpr ...

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

that said, the truediv keyword isn't supported for v < 2.0 so we still have to do this for eval

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

ok...let's just add an install of say numexpr 1.4 on say the 2.6 build...and just have the tests check that eval/query raise....no biggie

yeh < 2.0 should be effectively not installed

if yu want to get fancy you can raise a different message and say your numexpr is too old...(and of course if the import fails entirely say you need it)

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

also i have gotten similar weirdness with modules importing but not having certain attributes before. some issue with importing pkg_resources ... pytz had or has this issue sometimes... i used to get it with vbench

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

yep....sort of like import but require this version, otherwise raise...I think you have to do it sort of manually

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

ok...you are doing a new PR for this I assume? going to close @jtratner one....(as I think he tried to refactor a lot)

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

@cpcloud ref/close these #5857, #5855, #5845.

@cpcloud
Copy link
Member

cpcloud commented Jan 26, 2014

le checklist:

  • numexpr 1.4 on 2.6 build, check for raising in eval query
  • require version on expressions/evaluate (ndframe ops)

@jtratner
Copy link
Contributor Author

heh, I just got this to work I think.

@jreback
Copy link
Contributor

jreback commented Jan 26, 2014

#6109 looks fine..and ready to go...don't worry about it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants