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 2 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
2 changes: 1 addition & 1 deletion ci/deps/azure-36-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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
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
68 changes: 68 additions & 0 deletions doc/source/whatsnew/v1.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,74 @@ Assignment to multiple columns of a :class:`DataFrame` when some of the columns
df[['a', 'c']] = 1
df

.. _whatsnew_110.api_breaking.deps:

Increased minimum versions for dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some minimum supported versions of dependencies were updated (:issue:`33718`).
If installed, we now require:

+-----------------+-----------------+----------+---------+
| Package | Minimum Version | Required | Changed |
+=================+=================+==========+=========+
| numpy | 1.15.4 | X | X |
+-----------------+-----------------+----------+---------+
| pytz | 2015.4 | X | |
+-----------------+-----------------+----------+---------+
| python-dateutil | 2.6.1 | 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.
The following table lists the lowest version per library that is currently being tested throughout the development of pandas.
Optional libraries below the lowest tested version may still work, but are not considered supported.

+-----------------+-----------------+---------+
| Package | Minimum Version | Changed |
+=================+=================+=========+
| beautifulsoup4 | 4.6.0 | |
+-----------------+-----------------+---------+
| fastparquet | 0.3.2 | |
+-----------------+-----------------+---------+
| gcsfs | 0.2.2 | |
+-----------------+-----------------+---------+
| lxml | 3.8.0 | |
+-----------------+-----------------+---------+
| matplotlib | 2.2.2 | |
+-----------------+-----------------+---------+
| numba | 0.46.0 | |
+-----------------+-----------------+---------+
| openpyxl | 2.5.7 | |
+-----------------+-----------------+---------+
| pyarrow | 0.13.0 | |
+-----------------+-----------------+---------+
| pymysql | 0.7.1 | |
+-----------------+-----------------+---------+
| pytables | 3.4.2 | |
+-----------------+-----------------+---------+
| s3fs | 0.3.0 | |
+-----------------+-----------------+---------+
| scipy | 0.19.0 | |
+-----------------+-----------------+---------+
| sqlalchemy | 1.1.4 | |
+-----------------+-----------------+---------+
| xarray | 0.8.2 | |
+-----------------+-----------------+---------+
| xlrd | 1.1.0 | |
+-----------------+-----------------+---------+
| xlsxwriter | 0.9.8 | |
+-----------------+-----------------+---------+
| xlwt | 1.2.0 | |
+-----------------+-----------------+---------+

See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.

.. _whatsnew_110.deprecations:

Deprecations
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
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
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 @@ -109,9 +107,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 ("__sub__", "__rsub__"):
# 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/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Series,
Timedelta,
Timestamp,
_np_version_under1p14,
concat,
date_range,
option_context,
Expand Down Expand Up @@ -264,9 +263,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 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