Skip to content
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

ARROW-14968: [Python] Pin numpy build dependency using oldest-supported-numpy #11606

Closed
wants to merge 4 commits into from

Conversation

kszucs
Copy link
Member

@kszucs kszucs commented Nov 4, 2021

oldest-supported-numpy is a meta-package which defines the numpy version pins across platforms and python versions, this should make the python package maintenance easier and more future-proof.

cc @jorisvandenbossche

@@ -1,4 +1,4 @@
cython>=0.29
numpy>=1.16.6
Copy link
Member Author

Choose a reason for hiding this comment

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

We may need to keep this.

"numpy==1.19.4; python_version=='3.9'",
"numpy==1.21.3; python_version>'3.9'",
"setuptools",
"oldest-supported-numpy",
Copy link
Member Author

Choose a reason for hiding this comment

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

We may need to add numpy>=1.16.6 here as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, there are older numpy versions pinned for python < 3.8: https://github.com/scipy/oldest-supported-numpy/blob/master/setup.cfg#L44-L46

Copy link
Member

Choose a reason for hiding this comment

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

We don't support numpy <= 1.16.6? Do you remember the reason?

Copy link
Member Author

@kszucs kszucs Nov 4, 2021

Choose a reason for hiding this comment

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

Based on the blame it points to numpy/numpy#17913.

I guess the latest crossbow builds should fail if the pin is still required.

cc @xhochy

Copy link
Member

Choose a reason for hiding this comment

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

oldest-supported-numpy should be >=1.17, so no need to enforce this?

Copy link
Member

Choose a reason for hiding this comment

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

I think we already worked around the issue: #8834

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I searched for PyArray_DescrCheck across the codebase and didn't find any occurrences, so hope that pinning is not necessary.

Copy link
Member Author

@kszucs kszucs Nov 4, 2021

Choose a reason for hiding this comment

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

I wonder what do we need in install_requires: https://github.com/apache/arrow/blob/master/python/setup.py#L572

Just keep as is?

Copy link
Member

Choose a reason for hiding this comment

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

Let's not change it if it doesn't annoy anyone.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder what do we need in install_requires: https://github.com/apache/arrow/blob/master/python/setup.py#L572

Yes, I don't think this needs to be changed. oldest-supported-numpy is about build dependencies, not runtime install dependencies

@kszucs
Copy link
Member Author

kszucs commented Nov 4, 2021

@github-actions crossbow submit -g wheel python-sdist

We should also check the linux packaging before merging.

@github-actions
Copy link

github-actions bot commented Nov 4, 2021

Revision: 9ba0fdf

Submitted crossbow builds: ursacomputing/crossbow @ actions-1086

Task Status
python-sdist Github Actions
wheel-macos-big-sur-cp310-arm64 Github Actions
wheel-macos-big-sur-cp310-universal2 Github Actions
wheel-macos-big-sur-cp38-arm64 Github Actions
wheel-macos-big-sur-cp39-arm64 Github Actions
wheel-macos-big-sur-cp39-universal2 Github Actions
wheel-macos-high-sierra-cp310-amd64 Github Actions
wheel-macos-high-sierra-cp36-amd64 Github Actions
wheel-macos-high-sierra-cp37-amd64 Github Actions
wheel-macos-high-sierra-cp38-amd64 Github Actions
wheel-macos-high-sierra-cp39-amd64 Github Actions
wheel-macos-mavericks-cp310-amd64 Github Actions
wheel-macos-mavericks-cp36-amd64 Github Actions
wheel-macos-mavericks-cp37-amd64 Github Actions
wheel-macos-mavericks-cp38-amd64 Github Actions
wheel-macos-mavericks-cp39-amd64 Github Actions
wheel-manylinux2010-cp310-amd64 Github Actions
wheel-manylinux2010-cp36-amd64 Github Actions
wheel-manylinux2010-cp37-amd64 Github Actions
wheel-manylinux2010-cp38-amd64 Github Actions
wheel-manylinux2010-cp39-amd64 Github Actions
wheel-manylinux2014-cp310-amd64 Github Actions
wheel-manylinux2014-cp310-arm64 TravisCI
wheel-manylinux2014-cp36-amd64 Github Actions
wheel-manylinux2014-cp36-arm64 TravisCI
wheel-manylinux2014-cp37-amd64 Github Actions
wheel-manylinux2014-cp37-arm64 TravisCI
wheel-manylinux2014-cp38-amd64 Github Actions
wheel-manylinux2014-cp38-arm64 TravisCI
wheel-manylinux2014-cp39-amd64 Github Actions
wheel-manylinux2014-cp39-arm64 TravisCI
wheel-windows-cp310-amd64 Github Actions
wheel-windows-cp36-amd64 Github Actions
wheel-windows-cp37-amd64 Github Actions
wheel-windows-cp38-amd64 Github Actions
wheel-windows-cp39-amd64 Github Actions

@apache apache deleted a comment from github-actions bot Nov 4, 2021
@kszucs
Copy link
Member Author

kszucs commented Nov 4, 2021

@github-actions crossbow submit -g wheel python-sdist

@github-actions
Copy link

github-actions bot commented Nov 4, 2021

Revision: 8d346c1

Submitted crossbow builds: ursacomputing/crossbow @ actions-1088

Task Status
python-sdist Github Actions
wheel-macos-big-sur-cp310-arm64 Github Actions
wheel-macos-big-sur-cp310-universal2 Github Actions
wheel-macos-big-sur-cp38-arm64 Github Actions
wheel-macos-big-sur-cp39-arm64 Github Actions
wheel-macos-big-sur-cp39-universal2 Github Actions
wheel-macos-high-sierra-cp310-amd64 Github Actions
wheel-macos-high-sierra-cp36-amd64 Github Actions
wheel-macos-high-sierra-cp37-amd64 Github Actions
wheel-macos-high-sierra-cp38-amd64 Github Actions
wheel-macos-high-sierra-cp39-amd64 Github Actions
wheel-macos-mavericks-cp310-amd64 Github Actions
wheel-macos-mavericks-cp36-amd64 Github Actions
wheel-macos-mavericks-cp37-amd64 Github Actions
wheel-macos-mavericks-cp38-amd64 Github Actions
wheel-macos-mavericks-cp39-amd64 Github Actions
wheel-manylinux2010-cp310-amd64 Github Actions
wheel-manylinux2010-cp36-amd64 Github Actions
wheel-manylinux2010-cp37-amd64 Github Actions
wheel-manylinux2010-cp38-amd64 Github Actions
wheel-manylinux2010-cp39-amd64 Github Actions
wheel-manylinux2014-cp310-amd64 Github Actions
wheel-manylinux2014-cp310-arm64 TravisCI
wheel-manylinux2014-cp36-amd64 Github Actions
wheel-manylinux2014-cp36-arm64 TravisCI
wheel-manylinux2014-cp37-amd64 Github Actions
wheel-manylinux2014-cp37-arm64 TravisCI
wheel-manylinux2014-cp38-amd64 Github Actions
wheel-manylinux2014-cp38-arm64 TravisCI
wheel-manylinux2014-cp39-amd64 Github Actions
wheel-manylinux2014-cp39-arm64 TravisCI
wheel-windows-cp310-amd64 Github Actions
wheel-windows-cp36-amd64 Github Actions
wheel-windows-cp37-amd64 Github Actions
wheel-windows-cp38-amd64 Github Actions
wheel-windows-cp39-amd64 Github Actions

@kszucs kszucs changed the title [Python] Experiment with oldest-supported numpy [Python] Experiment with oldest-supported-numpy dependency Nov 4, 2021
@kszucs kszucs changed the title [Python] Experiment with oldest-supported-numpy dependency [Python] Experiment with pinning numpy using oldest-supported-numpy dependency Nov 4, 2021
@@ -1,4 +1,4 @@
cython>=0.29
numpy>=1.16.6
setuptools>=38.6.0
oldest-supported-numpy
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK this shouldn't be added here, this is purely a dependency for the build environment that pip creates

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, seems like we use this for development.

@@ -1,16 +1,5 @@
cython>=0.29.11
setuptools>=58
oldest-supported-numpy
Copy link
Member

Choose a reason for hiding this comment

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

same here, this file shouldn't be change AFAIK

Copy link
Member Author

@kszucs kszucs Nov 4, 2021

Choose a reason for hiding this comment

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

It would be better if we could rely on oldest-supported-numpy here since previously we pinned newer then necessary versions.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, so we use this file to manually create the "build environment", from where we call python setup.py bdist_wheel. Then I suppose we could indeed use oldest-supported-numpy here.

Now, I think the "proper" solution would be to stop using python setup.py bdist_wheel, and use python -m build instead (https://pypa-build.readthedocs.io/en/stable/). Then that would create the build environment based on what is already specified in pyproject.toml, and it would follow the same workflow as when you build a wheel when installing an sdist.
Although that brings up an interesting question: arrow-cpp also requires numpy to build. Should this be the same version? Or that should also follow the idea of "build against oldest supported"? (in which case we need to keep numpy anyway in this requirements file)

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's keep the requirements files for now and defer the pypa-build question to another issue.

@kszucs
Copy link
Member Author

kszucs commented Dec 1, 2021

@github-actions crossbow submit wheel-manylinux2010-cp310-amd64

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

Revision: e235ffe

Submitted crossbow builds: ursacomputing/crossbow @ actions-1232

Task Status
wheel-manylinux2010-cp310-amd64 Github Actions

@kszucs
Copy link
Member Author

kszucs commented Dec 1, 2021

@jorisvandenbossche the warning counts differ from the expected values in the pandas tests only for the python 3.7 builds. Could you please take a look at it? Do we need to pin a differrent pandas version there?

numpy==1.19.5; platform_system == "Darwin" and platform_machine != "arm64" and python_version < "3.9"
numpy==1.21.3; platform_system == "Darwin" and platform_machine != "arm64" and python_version >= "3.9"
numpy==1.19.5; platform_system == "Windows" and python_version < "3.9"
numpy==1.21.3; platform_system == "Windows" and python_version >= "3.9"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can keep this, so we test with a numpy version of around the same "age" as the pandas version below

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for taking a look! I'm going to restore these pins, hopefully that'll fix the tests.

@jorisvandenbossche
Copy link
Member

I suppose it is not specific to Python 3.7, but due to a combination of versions of other packages that get installed. One guess is that because of having an older pandas version (1.0.5) but the latest numpy (1.21.3), numpy raises some warnings that are not only fixed in newer pandas versions.
When using pandas 1.0.5 to test, we probably should also install the numpy version that was releases around the same time as pandas 1.0.5, to ensure compatibility between numpy and pandas.

For Python 3.6 this doesn't happen because an older version of numpy gets installed (I suppose there are no wheels for the latest numpy release for python 3.6)

@kszucs kszucs changed the title [Python] Experiment with pinning numpy using oldest-supported-numpy dependency ARROW-14968: [Python] Pin numpy build dependency using oldest-supported-numpy Dec 2, 2021
@apache apache deleted a comment from github-actions bot Dec 2, 2021
@github-actions
Copy link

github-actions bot commented Dec 2, 2021

@github-actions
Copy link

github-actions bot commented Dec 2, 2021

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

@kszucs
Copy link
Member Author

kszucs commented Dec 2, 2021

@github-actions crossbow submit -g wheel python-sdist

@github-actions
Copy link

github-actions bot commented Dec 2, 2021

Revision: 4f6c78c

Submitted crossbow builds: ursacomputing/crossbow @ actions-1237

Task Status
python-sdist Github Actions
wheel-macos-big-sur-cp310-arm64 Github Actions
wheel-macos-big-sur-cp310-universal2 Github Actions
wheel-macos-big-sur-cp38-arm64 Github Actions
wheel-macos-big-sur-cp39-arm64 Github Actions
wheel-macos-big-sur-cp39-universal2 Github Actions
wheel-macos-high-sierra-cp310-amd64 Github Actions
wheel-macos-high-sierra-cp36-amd64 Github Actions
wheel-macos-high-sierra-cp37-amd64 Github Actions
wheel-macos-high-sierra-cp38-amd64 Github Actions
wheel-macos-high-sierra-cp39-amd64 Github Actions
wheel-macos-mavericks-cp310-amd64 Github Actions
wheel-macos-mavericks-cp36-amd64 Github Actions
wheel-macos-mavericks-cp37-amd64 Github Actions
wheel-macos-mavericks-cp38-amd64 Github Actions
wheel-macos-mavericks-cp39-amd64 Github Actions
wheel-manylinux2010-cp310-amd64 Github Actions
wheel-manylinux2010-cp36-amd64 Github Actions
wheel-manylinux2010-cp37-amd64 Github Actions
wheel-manylinux2010-cp38-amd64 Github Actions
wheel-manylinux2010-cp39-amd64 Github Actions
wheel-manylinux2014-cp310-amd64 Github Actions
wheel-manylinux2014-cp310-arm64 TravisCI
wheel-manylinux2014-cp36-amd64 Github Actions
wheel-manylinux2014-cp36-arm64 TravisCI
wheel-manylinux2014-cp37-amd64 Github Actions
wheel-manylinux2014-cp37-arm64 TravisCI
wheel-manylinux2014-cp38-amd64 Github Actions
wheel-manylinux2014-cp38-arm64 TravisCI
wheel-manylinux2014-cp39-amd64 Github Actions
wheel-manylinux2014-cp39-arm64 TravisCI
wheel-windows-cp310-amd64 Github Actions
wheel-windows-cp36-amd64 Github Actions
wheel-windows-cp37-amd64 Github Actions
wheel-windows-cp38-amd64 Github Actions
wheel-windows-cp39-amd64 Github Actions

@apache apache deleted a comment from github-actions bot Dec 2, 2021
@pitrou
Copy link
Member

pitrou commented Dec 2, 2021

@github-actions crossbow submit -g python

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

This looks it should be ok, though I'm not sure what the repercussions will be.

@github-actions
Copy link

github-actions bot commented Dec 2, 2021

Revision: 4f6c78c

Submitted crossbow builds: ursacomputing/crossbow @ actions-1238

Task Status
test-conda-python-3.10 Github Actions
test-conda-python-3.6 Github Actions
test-conda-python-3.6-pandas-0.23 Github Actions
test-conda-python-3.7 Github Actions
test-conda-python-3.7-hdfs-2.9.2 Github Actions
test-conda-python-3.7-hdfs-3.2.1 Github Actions
test-conda-python-3.7-kartothek-latest Github Actions
test-conda-python-3.7-kartothek-master Github Actions
test-conda-python-3.7-pandas-0.24 Github Actions
test-conda-python-3.7-pandas-latest Github Actions
test-conda-python-3.7-spark-v3.1.2 Github Actions
test-conda-python-3.8 Github Actions
test-conda-python-3.8-hypothesis Github Actions
test-conda-python-3.8-pandas-latest Github Actions
test-conda-python-3.8-pandas-nightly Github Actions
test-conda-python-3.8-spark-v3.2.0 Github Actions
test-conda-python-3.9 Github Actions
test-conda-python-3.9-dask-latest Github Actions
test-conda-python-3.9-dask-master Github Actions
test-conda-python-3.9-pandas-master Github Actions
test-conda-python-3.9-spark-master Github Actions
test-debian-11-python-3 Azure
test-fedora-33-python-3 Azure
test-ubuntu-18.04-python-3 Azure

@kszucs kszucs closed this in a71c1e6 Dec 6, 2021
@ursabot
Copy link

ursabot commented Dec 6, 2021

Benchmark runs are scheduled for baseline = 8cebc49 and contender = a71c1e6. a71c1e6 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️1.35% ⬆️0.45%] ursa-i9-9960x
[Finished ⬇️0.18% ⬆️0.04%] ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants