-
Notifications
You must be signed in to change notification settings - Fork 181
Cython 3 and numpy 2 #3290
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
Closed
Cython 3 and numpy 2 #3290
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
24462b5
Fix cython files for Cython 3.0
connorjward abeb70b
update firedrake-install for numpy deps
connorjward 4322030
lint
connorjward 7856e78
Silly fixes
connorjward 97394e7
Add ninja system dependency
connorjward 2fd6535
Since we are using the docker container
connorjward a061ff1
fixup
connorjward 2460c07
Install with numpy 2.0 release candidate
connorjward f95dd2b
Merge remote-tracking branch 'origin/master' into connorjward/cython3
connorjward fbe58f1
fixup
connorjward ad32e6c
fixup
connorjward 81801ca
fixup
connorjward ef73ae7
fixup
connorjward 08f1002
fixup
connorjward 0c2d63c
PYOP2 branch
connorjward 1bba98b
fixup
connorjward 9abe4fc
fixup
connorjward 1b0d679
fixup
connorjward 58dddbf
fixup
connorjward bd8d5d8
loopy is now updated
connorjward ad9a12e
Merge remote-tracking branch 'origin/master' into connorjward/cython3
connorjward File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -686,7 +686,6 @@ def check_output(args): | |
| raise | ||
|
|
||
|
|
||
| pyinstall = [python, "setup.py", "install"] | ||
| if "PYTHONPATH" in os.environ and not args.honour_pythonpath: | ||
| quit("""The PYTHONPATH environment variable is set. This is probably an error. | ||
| If you really want to use your own Python packages, please run again with the | ||
|
|
@@ -993,14 +992,10 @@ def run_pip_install(pipargs): | |
| # subprocesses wrote out. | ||
| # Particularly important for debugging petsc fails. | ||
| with environment(**blas): | ||
| pipargs = ["-vvv"] + pipargs | ||
| pipargs = ["-v"] + pipargs | ||
| check_call(pipinstall + pipargs) | ||
|
|
||
|
|
||
| def run_cmd(args): | ||
| check_call(args) | ||
|
|
||
|
|
||
| def get_requirements(reqfname): | ||
| with open(reqfname, "r") as f: | ||
| reqs = f.readlines() | ||
|
|
@@ -1013,14 +1008,6 @@ def run_pip_install_wrap(reqs, parallel_compiler_env): | |
| if package_name in parallel_packages: | ||
| with environment(**parallel_compiler_env): | ||
| run_pip_install([req]) | ||
| elif package_name == "numpy": | ||
| # Downgrade setuptools and wheel for numpy | ||
| run_pip(["install", "-U", "setuptools==59.2.0"]) | ||
| run_pip(["install", "-U", "wheel==0.37.0"]) | ||
| run_pip_install(["numpy==1.24"]) | ||
| # Upgrade setuptools and wheel for everything else | ||
| run_pip(["install", "-U", "setuptools"]) | ||
| run_pip(["install", "-U", "wheel"]) | ||
| else: | ||
| run_pip_install([req]) | ||
|
|
||
|
|
@@ -1347,8 +1334,9 @@ def build_and_install_torch(): | |
| raise InstallError("CUDA installation is not available on MacOS.") | ||
| if sys.version_info >= (3, 10): | ||
| run_pip_install(["typing_extensions"]) | ||
| extra_index_url = ["--extra-index-url", "https://download.pytorch.org/whl/cpu"] if args.torch == "cpu" else [] | ||
| run_pip_install(["torch"] + extra_index_url) | ||
| # FIXME: use nightly to see if that makes numpy 2.0 happy | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should really be as detailed in https://dev-discuss.pytorch.org/t/pytorch-release-2-3-0-final-rc-is-available/1995 2.3.0 is supposed to be released 24/04. |
||
| extra_index_url = ["--extra-index-url", "https://download.pytorch.org/whl/nightly/cpu"] if args.torch == "cpu" else [] | ||
| run_pip_install(["--pre", "torch"] + extra_index_url) | ||
|
|
||
|
|
||
| def build_and_install_slepc(): | ||
|
|
@@ -1567,6 +1555,7 @@ if mode == "install" or not args.update_script: | |
| "make", | ||
| "automake", | ||
| "cmake", | ||
| "ninja", | ||
| "libtool", | ||
| "boost"] | ||
| if args.with_blas is None and mode == "install": | ||
|
|
@@ -1585,6 +1574,7 @@ if mode == "install" or not args.update_script: | |
| "pkgconf", # for p4est | ||
| "libtool", | ||
| "libxml2-dev", | ||
| "ninja-build", # for meson/numpy | ||
| "python3-dev", | ||
| "python3-pip", | ||
| "python3-tk", | ||
|
|
@@ -1724,14 +1714,19 @@ if mode == "install": | |
| os.environ["VIRTUAL_ENV"] = firedrake_env | ||
|
|
||
| # Ensure pip, setuptools, hatchling and wheel are at the latest version. | ||
| # numpy requires setuptools==59.2.0 and wheel==0.37.0 until it moves to meson build | ||
| run_pip(["install", "-U", "setuptools==59.2.0"]) | ||
| run_pip(["install", "-U", "setuptools"]) | ||
| run_pip(["install", "-U", "hatch"]) | ||
| run_pip(["install", "-U", "pip"]) | ||
| run_pip(["install", "-U", "wheel==0.37.0"]) | ||
| run_pip(["install", "-U", "wheel"]) | ||
|
|
||
| # Extra numpy dependendencies, see | ||
| # https://github.com/numpy/numpy/blob/main/pyproject.toml | ||
| run_pip(["install", "-U", "meson-python>=0.15.0"]) | ||
| run_pip(["install", "-U", "Cython>=3.0.6"]) | ||
|
|
||
| # Pin Cython because it's causing multiple packages to fail to build | ||
| run_pip(["install", "-U", "Cython==0.29.36"]) | ||
| # 11/04/24 Install a 2.0 release candidate because 2.0 has not yet been | ||
| # officially released but we cannot build petsc4py without it. | ||
| run_pip(["install", "-U", "numpy==2.0.0rc1"]) | ||
|
|
||
| # Loopy has additional build dependencies | ||
| run_pip(["install", "-U", "scikit-build"]) | ||
|
|
@@ -1819,24 +1814,12 @@ if mode == "install": | |
| # recovery can be attempted if required. | ||
| build_update_script() | ||
|
|
||
| # Force Cython to install first to work around pip dependency issues. | ||
| run_pip_install(["Cython>=0.22"]) | ||
|
|
||
| # Pre-install requested packages | ||
| if args.pip_packages is not None: | ||
| for package in args.pip_packages: | ||
| log.info("Pip installing %s to venv" % package) | ||
| run_pip_install_wrap(package.split(), {}) | ||
|
|
||
| # numpy requires old setuptools (+wheel) | ||
| log.info("Installing numpy using setuptools==59.2.0 and wheel==0.37.0 and Cython==0.29.36") | ||
| log.info("Installing numpy==1.24 due to performance regression") | ||
| # https://github.com/inducer/pytential/issues/211 | ||
| run_pip_install(["numpy==1.24"]) | ||
| log.info("Updating setuptools and wheel to latest versions") | ||
| run_pip(["install", "-U", "setuptools"]) | ||
| run_pip(["install", "-U", "wheel"]) | ||
|
|
||
| # Install VTK | ||
| if not args.no_vtk: | ||
| log.info("Pip installing VTK to venv") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂