Skip to content

BLD: bump numpy min version to 1.15.4 #33729

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

Merged
merged 14 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ci/deps/azure-36-minimum_versions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: pandas-dev
channels:
- defaults
- conda-forge
dependencies:
- python=3.6.1
Expand All @@ -19,12 +18,12 @@ dependencies:
- jinja2=2.8
- numba=0.46.0
- numexpr=2.6.2
- numpy=1.13.3
- numpy=1.15.4
- openpyxl=2.5.7
- pytables=3.4.3
- python-dateutil=2.7.3
- pytz=2017.2
- scipy=0.19.0
- scipy=1.2
- xlrd=1.1.0
- xlsxwriter=0.9.8
- xlwt=1.2.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-macos-36.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- matplotlib=2.2.3
- nomkl
- numexpr
- numpy=1.14
- numpy=1.15.4
- openpyxl
- pyarrow>=0.13.0
- pytables
Expand Down
4 changes: 2 additions & 2 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ requirements:
- cython
- numpy
- setuptools >=3.3
- python-dateutil >=2.5.0
- python-dateutil >=2.7.3
- pytz
run:
- python {{ python }}
- {{ pin_compatible('numpy') }}
- python-dateutil >=2.5.0
- python-dateutil >=2.7.3
- pytz

test:
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Dependencies
Package Minimum supported version
================================================================ ==========================
`setuptools <https://setuptools.readthedocs.io/en/latest/>`__ 24.2.0
`NumPy <https://www.numpy.org>`__ 1.13.3
`NumPy <https://www.numpy.org>`__ 1.15.4
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.7.3
`pytz <https://pypi.org/project/pytz/>`__ 2017.2
================================================================ ==========================
Expand Down
16 changes: 13 additions & 3 deletions doc/source/whatsnew/v1.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,23 @@ Other enhancements
Increased minimum versions for dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some minimum supported versions of dependencies were updated (:issue:`29766`, :issue:`29723`, pytables >= 3.4.3).
Some minimum supported versions of dependencies were updated (:issue:`33718`, :issue:`29766`, :issue:`29723`, pytables >= 3.4.3).
If installed, we now require:

+-----------------+-----------------+----------+---------+
| Package | Minimum Version | Required | Changed |
+=================+=================+==========+=========+
| python-dateutil | 2.7.3 | X | |
| numpy | 1.15.4 | X | X |
+-----------------+-----------------+----------+---------+
| pytz | 2015.4 | X | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should prob bump this just for consistency

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. what to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess 2019 ish, but maybe doesn't matter

+-----------------+-----------------+----------+---------+
| python-dateutil | 2.7.3 | X | X |
+-----------------+-----------------+----------+---------+
| bottleneck | 1.2.1 | | |
+-----------------+-----------------+----------+---------+
| numexpr | 2.6.2 | | |
+-----------------+-----------------+----------+---------+
| pytest (dev) | 4.0.2 | | |
+-----------------+-----------------+----------+---------+

For `optional libraries <https://dev.pandas.io/docs/install.html#dependencies>`_ the general recommendation is to use the latest version.
Expand Down Expand Up @@ -195,7 +205,7 @@ Optional libraries below the lowest tested version may still work, but are not c
+-----------------+-----------------+---------+
| s3fs | 0.3.0 | |
+-----------------+-----------------+---------+
| scipy | 0.19.0 | |
| scipy | 1.2.0 | X |
+-----------------+-----------------+---------+
| sqlalchemy | 1.1.4 | |
+-----------------+-----------------+---------+
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies:
- jinja2 # pandas.Styler
- matplotlib>=2.2.2 # pandas.plotting, Series.plot, DataFrame.plot
- numexpr>=2.6.8
- scipy>=1.1
- scipy>=1.2
- numba>=0.46.0

# optional for io
Expand Down
2 changes: 0 additions & 2 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

# numpy compat
from pandas.compat.numpy import (
_np_version_under1p14,
_np_version_under1p15,
_np_version_under1p16,
_np_version_under1p17,
_np_version_under1p18,
Expand Down
2 changes: 1 addition & 1 deletion pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"pytest": "5.0.1",
"pyxlsb": "1.0.6",
"s3fs": "0.3.0",
"scipy": "0.19.0",
"scipy": "1.2.0",
"sqlalchemy": "1.1.4",
"tables": "3.4.3",
"tabulate": "0.8.3",
Expand Down
10 changes: 3 additions & 7 deletions pandas/compat/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
# numpy versioning
_np_version = np.__version__
_nlv = LooseVersion(_np_version)
_np_version_under1p14 = _nlv < LooseVersion("1.14")
_np_version_under1p15 = _nlv < LooseVersion("1.15")
_np_version_under1p16 = _nlv < LooseVersion("1.16")
_np_version_under1p17 = _nlv < LooseVersion("1.17")
_np_version_under1p18 = _nlv < LooseVersion("1.18")
_is_numpy_dev = ".dev" in str(_nlv)


if _nlv < "1.13.3":
if _nlv < "1.15.4":
raise ImportError(
"this version of pandas is incompatible with numpy < 1.13.3\n"
"this version of pandas is incompatible with numpy < 1.15.4\n"
f"your numpy version is {_np_version}.\n"
"Please upgrade numpy to >= 1.13.3 to use this pandas version"
"Please upgrade numpy to >= 1.15.4 to use this pandas version"
)


Expand Down Expand Up @@ -65,8 +63,6 @@ def np_array_datetime64_compat(arr, *args, **kwargs):
__all__ = [
"np",
"_np_version",
"_np_version_under1p14",
"_np_version_under1p15",
"_np_version_under1p16",
"_np_version_under1p17",
"_is_numpy_dev",
Expand Down
2 changes: 0 additions & 2 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ class TestPDApi(Base):
"_hashtable",
"_lib",
"_libs",
"_np_version_under1p14",
"_np_version_under1p15",
"_np_version_under1p16",
"_np_version_under1p17",
"_np_version_under1p18",
Expand Down
15 changes: 7 additions & 8 deletions pandas/tests/dtypes/cast/test_promote.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@ def _assert_match(result_fill_value, expected_fill_value):
# GH#23982/25425 require the same type in addition to equality/NA-ness
res_type = type(result_fill_value)
ex_type = type(expected_fill_value)
if res_type.__name__ == "uint64":
# No idea why, but these (sometimes) do not compare as equal
assert ex_type.__name__ == "uint64"
elif res_type.__name__ == "ulonglong":
# On some builds we get this instead of np.uint64
# Note: cant check res_type.dtype.itemsize directly on numpy 1.18
assert res_type(0).itemsize == 8
assert ex_type == res_type or ex_type == np.uint64

if hasattr(result_fill_value, "dtype"):
# Compare types in a way that is robust to platform-specific
# idiosyncracies where e.g. sometimes we get "ulonglong" as an alias
# for "uint64" or "intc" as an alias for "int32"
assert result_fill_value.dtype.kind == expected_fill_value.dtype.kind
assert result_fill_value.dtype.itemsize == expected_fill_value.dtype.itemsize
else:
# On some builds, type comparison fails, e.g. np.int32 != np.int32
assert res_type == ex_type or res_type.__name__ == ex_type.__name__
Expand Down
5 changes: 0 additions & 5 deletions pandas/tests/extension/test_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import numpy as np
import pytest

from pandas.compat.numpy import _np_version_under1p14

import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.boolean import BooleanDtype
Expand Down Expand Up @@ -111,9 +109,6 @@ def check_opname(self, s, op_name, other, exc=None):
def _check_op(self, s, op, other, op_name, exc=NotImplementedError):
if exc is None:
if op_name in self.implements:
# subtraction for bools raises TypeError (but not yet in 1.13)
if _np_version_under1p14:
pytest.skip("__sub__ does not yet raise in numpy 1.13")
msg = r"numpy boolean subtract"
with pytest.raises(TypeError, match=msg):
op(s, other)
Expand Down
5 changes: 1 addition & 4 deletions pandas/tests/frame/methods/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Timedelta,
Timestamp,
UInt64Index,
_np_version_under1p14,
concat,
date_range,
option_context,
Expand Down Expand Up @@ -169,9 +168,7 @@ def test_astype_str_float(self):
tm.assert_frame_equal(result, expected)
result = DataFrame([1.12345678901234567890]).astype(str)

# < 1.14 truncates
# >= 1.14 preserves the full repr
val = "1.12345678901" if _np_version_under1p14 else "1.1234567890123457"
val = "1.1234567890123457"
expected = DataFrame([val])
tm.assert_frame_equal(result, expected)

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ requires = [
"setuptools",
"wheel",
"Cython>=0.29.16", # Note: sync with setup.py
"numpy==1.13.3; python_version=='3.6' and platform_system!='AIX'",
"numpy==1.14.5; python_version>='3.7' and platform_system!='AIX'",
"numpy==1.15.4; python_version=='3.6' and platform_system!='AIX'",
"numpy==1.15.4; python_version>='3.7' and platform_system!='AIX'",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be "numpy>=1.15.4"? I had issues installing pandas from source with numpy 1.18.5 installed.
Should I create a ticket for that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so. We build with the oldest supported NumPy that is compatible with the version of NumPy.

I had issues installing pandas from source with numpy 1.18.5 installed.

This also doesn't quite make sense. The idea behind pyproject.toml is to isolate the build environment. It shouldn't matter what version of NumPy was used to build pandas with, as long as it's binary compatible (IIUC).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, ignore my comment if that is how you make sure that your build with the oldest supported version.

In my case I have numpy 1.18.5 installed and I want to use it to build pandas from source. However, it complains that the build requirements are note met.

Installing build dependencies ... error
ERROR: Complete output from command /opt/project/venv37/bin/python3.7 /opt/project/venv37/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-0xz070yu/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links https://project:[email protected]:443/project -- setuptools wheel 'Cython>=0.29.13' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version>='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'':
ERROR: Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX"' don't match your environment
Ignoring numpy: markers 'python_version == "3.6" and platform_system == "AIX"' don't match your environment
Ignoring numpy: markers 'python_version >= "3.7" and platform_system == "AIX"' don't match your environment
Looking in links: https://*redacted*
Collecting setuptools
Collecting wheel
Collecting Cython>=0.29.13
Collecting numpy==1.14.5
  ERROR: Could not find a version that satisfies the requirement numpy==1.14.5 (from versions: 1.18.5)
ERROR: No matching distribution found for numpy==1.14.5

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, were you using python 3.8? There was an issue with us not having a line for py38. #34667

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, 3.7.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I didn't quite understood how build isolation works. Thanks for your quick relies!

"numpy==1.16.0; python_version=='3.6' and platform_system=='AIX'",
"numpy==1.16.0; python_version>='3.7' and platform_system=='AIX'",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ipython>=7.11.1
jinja2
matplotlib>=2.2.2
numexpr>=2.6.8
scipy>=1.1
scipy>=1.2
numba>=0.46.0
beautifulsoup4>=4.6.0
html5lib
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def is_platform_mac():
return sys.platform == "darwin"


min_numpy_ver = "1.13.3"
min_numpy_ver = "1.15.4"
min_cython_ver = "0.29.16" # note: sync with pyproject.toml

try:
Expand Down