Skip to content

Commit

Permalink
BLD: Numexpr 2.4.6 required
Browse files Browse the repository at this point in the history
closes pandas-dev#15213

Author: Francesc Alted <francesc@continuum.io>

Closes pandas-dev#15383 from FrancescAlted/numexpr-2.4.6 and squashes the following commits:

c417fe2 [Francesc Alted] Simplify and remove UserWarning testing on numexpr import
e1b34a9 [Francesc Alted] Force a reload of pd.computation for actually triggering the UserWarning
c081199 [Francesc Alted] Relax the exact message for the ImportError
73f0319 [Francesc Alted] numexpr requisite raised to 2.4.6
0d4ab9a [Francesc Alted] Restored the old numexpr version dependencies to adjust for old requirements
c1aae19 [Francesc Alted] Fixed a lint error
7575ba2 [Francesc Alted] Using constants instead of literals for numexpr version
7a275ce [Francesc Alted] Fixed a typo
93f54aa [Francesc Alted] numexpr section moved to Other API changes section
3b6e58b [Francesc Alted] Removed recomendation for numexpr 2.6.2
f225598 [Francesc Alted] Updated test_compat for numexpr 2.4.6
8bd4ed1 [Francesc Alted] numexpr 2.4.6 requirement moved to other enhancements section
e45b742 [Francesc Alted] Moved pinned versions in CI folder to 2.4.6
6e12e29 [Francesc Alted] Added a notice on the recommended numexpr version
ac62653 [Francesc Alted] Require numexpr 2.4.6
ab79c54 [Francesc Alted] Require numexpr 2.6.2
  • Loading branch information
Francesc Alted authored and jreback committed Feb 15, 2017
1 parent bbb583c commit 2372d27
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion ci/requirements-3.4_SLOW.run
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ html5lib
patsy
beautiful-soup
scipy
numexpr=2.4.4
numexpr=2.4.6
pytables
matplotlib
lxml
Expand Down
2 changes: 1 addition & 1 deletion doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Recommended Dependencies

* `numexpr <https://github.com/pydata/numexpr>`__: for accelerating certain numerical operations.
``numexpr`` uses multiple cores as well as smart chunking and caching to achieve large speedups.
If installed, must be Version 2.1 or higher (excluding a buggy 2.4.4). Version 2.4.6 or higher is highly recommended.
If installed, must be Version 2.4.6 or higher.

* `bottleneck <http://berkeleyanalytics.com/bottleneck>`__: for accelerating certain types of ``nan``
evaluations. ``bottleneck`` uses specialized cython routines to achieve large speedups.
Expand Down
4 changes: 3 additions & 1 deletion doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _whatsnew_0200:

v0.20.0 (????, 2016)
v0.20.0 (????, 2017)
--------------------

This is a major release from 0.19 and includes a small number of API changes, several new features,
Expand Down Expand Up @@ -158,6 +158,7 @@ Other enhancements

.. _whatsnew_0200.api_breaking:


Backwards incompatible API changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -429,6 +430,7 @@ Other API Changes
- ``DataFrame.asof()`` will return a null filled ``Series`` instead the scalar ``NaN`` if a match is not found (:issue:`15118`)
- The :func:`pd.read_gbq` method now stores ``INTEGER`` columns as ``dtype=object`` if they contain ``NULL`` values. Otherwise they are stored as ``int64``. This prevents precision lost for integers greather than 2**53. Furthermore ``FLOAT`` columns with values above 10**4 are no more casted to ``int64`` which also caused precision lost (:issue: `14064`, :issue:`14305`).
- Reorganization of timeseries development tests (:issue:`14854`)
- ``numexpr`` version is now required to be >= 2.4.6 and it will not be used at all if this requisite is not fulfilled (:issue:`15213`).

.. _whatsnew_0200.deprecations:

Expand Down
17 changes: 5 additions & 12 deletions pandas/computation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,19 @@
from distutils.version import LooseVersion

_NUMEXPR_INSTALLED = False
_MIN_NUMEXPR_VERSION = "2.4.6"

try:
import numexpr as ne
ver = ne.__version__
_NUMEXPR_INSTALLED = ver >= LooseVersion('2.1')
_NUMEXPR_INSTALLED = ver >= LooseVersion(_MIN_NUMEXPR_VERSION)

# we specifically disallow 2.4.4 as
# has some hard-to-diagnose bugs
if ver == LooseVersion('2.4.4'):
_NUMEXPR_INSTALLED = False
warnings.warn(
"The installed version of numexpr {ver} is not supported "
"in pandas and will be not be used\n".format(ver=ver),
UserWarning)

elif not _NUMEXPR_INSTALLED:
if not _NUMEXPR_INSTALLED:
warnings.warn(
"The installed version of numexpr {ver} is not supported "
"in pandas and will be not be used\nThe minimum supported "
"version is 2.1\n".format(ver=ver), UserWarning)
"version is {min_ver}\n".format(
ver=ver, min_ver=_MIN_NUMEXPR_VERSION), UserWarning)

except ImportError: # pragma: no cover
pass
Expand Down
15 changes: 4 additions & 11 deletions pandas/tests/computation/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from pandas.computation.engines import _engines
import pandas.computation.expr as expr
from pandas.computation import _MIN_NUMEXPR_VERSION

ENGINES_PARSERS = list(product(_engines, expr._parsers))

Expand All @@ -21,15 +22,10 @@ def test_compat():
try:
import numexpr as ne
ver = ne.__version__
if ver == LooseVersion('2.4.4'):
if ver < LooseVersion(_MIN_NUMEXPR_VERSION):
assert not _NUMEXPR_INSTALLED
elif ver < LooseVersion('2.1'):
with tm.assert_produces_warning(UserWarning,
check_stacklevel=False):
assert not _NUMEXPR_INSTALLED
else:
assert _NUMEXPR_INSTALLED

except ImportError:
pytest.skip("not testing numexpr version compat")

Expand All @@ -51,12 +47,9 @@ def testit():
except ImportError:
pytest.skip("no numexpr")
else:
if ne.__version__ < LooseVersion('2.1'):
with tm.assertRaisesRegexp(ImportError, "'numexpr' version is "
".+, must be >= 2.1"):
if ne.__version__ < LooseVersion(_MIN_NUMEXPR_VERSION):
with tm.assertRaises(ImportError):
testit()
elif ne.__version__ == LooseVersion('2.4.4'):
pytest.skip("numexpr version==2.4.4")
else:
testit()
else:
Expand Down

0 comments on commit 2372d27

Please sign in to comment.