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

Updates to work with numpy 2.0 #5979

Merged
merged 3 commits into from
Nov 6, 2023
Merged

Updates to work with numpy 2.0 #5979

merged 3 commits into from
Nov 6, 2023

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Nov 6, 2023

Found with the latest release of ruff and this command ruff check . --preview --select=NPY201 --fix

holoviews/core/util.py Outdated Show resolved Hide resolved
@hoxbro hoxbro enabled auto-merge (squash) November 6, 2023 08:47
@hoxbro hoxbro merged commit 0ca2aac into main Nov 6, 2023
10 checks passed
@hoxbro hoxbro deleted the npy2 branch November 6, 2023 09:48
@jakirkham
Copy link
Contributor

Thanks Simon! 🙏

Is HoloViews running CI with NumPy 2?

@hoxbro
Copy link
Member Author

hoxbro commented Apr 25, 2024

I just tried enabling it, but I could not get it to solve because of matplotlib. Though looking at numpy/numpy#26191 it seems like it should be supported in version 3.8.4

mamba create -n tmp "numpy=2.0.0rc1" matplotlib-base -c conda-forge/label/numpy_dev

Getting this error:

The following packages are incompatible
├─ matplotlib-base is installable with the potential options
│  ├─ matplotlib-base [2.1.2|2.2.4|...|3.2.2] would require
│  │  └─ numpy >=1.14.6,<2.0a0 , which can be installed;
│  ├─ matplotlib-base 2.2.3 would require
│  │  └─ numpy >=1.9.3,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [2.2.5|3.3.0|3.3.1|3.3.2|3.3.3] would require
│  │  └─ numpy >=1.16.5,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [2.2.5|3.3.2] would require
│  │  └─ numpy >=1.19.2,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [2.2.5|3.3.2|3.3.3] would require
│  │  └─ numpy >=1.19.4,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.0.2|3.0.3|3.1.0] would require
│  │  └─ numpy >=1.11.3,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.2.2|3.3.0|...|3.5.1] would require
│  │  └─ numpy >=1.18.5,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.3.0|3.3.1|3.3.2] would require
│  │  └─ numpy >=1.15.4,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.3.3|3.3.4] would require
│  │  └─ numpy >=1.16.6,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.3.3|3.3.4|...|3.5.3] would require
│  │  └─ numpy >=1.19.5,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.4.1|3.4.2] would require
│  │  └─ numpy >=1.17.5,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.4.3|3.5.0|3.5.1] would require
│  │  └─ numpy >=1.21.4,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.5.2|3.5.3|...|3.7.2] would require
│  │  └─ numpy >=1.21.6,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.6.0|3.6.1|...|3.7.1] would require
│  │  └─ numpy >=1.20.3,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.6.1|3.6.2] would require
│  │  └─ numpy >=1.23.4,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.6.3|3.7.0|...|3.8.4] would require
│  │  └─ numpy >=1.23.5,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.7.3|3.8.0|...|3.8.4] would require
│  │  └─ numpy >=1.22.4,<2.0a0 , which can be installed;
│  ├─ matplotlib-base [3.8.0|3.8.1|3.8.2] would require
│  │  └─ numpy >=1.26.0,<2.0a0 , which can be installed;
│  └─ matplotlib-base [3.8.3|3.8.4] would require
│     └─ numpy >=1.26.4,<2.0a0 , which can be installed;
└─ numpy 2.0.0rc1**  is not installable because it conflicts with any installable versions previously reported.

@jakirkham
Copy link
Contributor

Thanks Simon! 🙏

On the conda-forge side, we need to start a NumPy 2 migration to build other packages with NumPy 2. There is some work happening in that direction in PR ( conda-forge/conda-forge-pinning-feedstock#5790 ). However it is not yet ready to ship. Hopefully soon

@jakirkham
Copy link
Contributor

Since we last talked, the NumPy 2 migration in conda-forge has begun

Matplotlib has also been migrated. So installing it now does work (please see "Details" below)

Are there other dependencies we need here?

conda create -n tmp -c conda-forge/label/numpy_rc "numpy=2.0.0rc1" matplotlib-base --dry-run
Channels:
 - conda-forge/label/numpy_rc
 - conda-forge
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/jkirkham/miniforge/envs/tmp

  added / updated specs:
    - matplotlib-base
    - numpy=2.0.0rc1


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    cycler-0.12.1              |     pyhd8ed1ab_0          13 KB  conda-forge
    fonttools-4.51.0           |  py312he37b823_0         2.6 MB  conda-forge
    kiwisolver-1.4.5           |  py312h389731b_1          60 KB  conda-forge
    matplotlib-base-3.8.4      |  py312h4479663_1         7.4 MB  conda-forge
    munkres-1.1.4              |     pyh9f0ad1d_0          12 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        10.1 MB

The following NEW packages will be INSTALLED:

  _numpy_rc          conda-forge/label/numpy_rc/noarch::_numpy_rc-1-h23db71c_0 
  brotli             conda-forge/osx-arm64::brotli-1.1.0-hb547adb_1 
  brotli-bin         conda-forge/osx-arm64::brotli-bin-1.1.0-hb547adb_1 
  bzip2              conda-forge/osx-arm64::bzip2-1.0.8-h93a5062_5 
  ca-certificates    conda-forge/osx-arm64::ca-certificates-2024.2.2-hf0a4a13_0 
  certifi            conda-forge/noarch::certifi-2024.2.2-pyhd8ed1ab_0 
  contourpy          conda-forge/osx-arm64::contourpy-1.2.1-py312h0fef576_0 
  cycler             conda-forge/noarch::cycler-0.12.1-pyhd8ed1ab_0 
  fonttools          conda-forge/osx-arm64::fonttools-4.51.0-py312he37b823_0 
  freetype           conda-forge/osx-arm64::freetype-2.12.1-hadb7bae_2 
  kiwisolver         conda-forge/osx-arm64::kiwisolver-1.4.5-py312h389731b_1 
  lcms2              conda-forge/osx-arm64::lcms2-2.16-ha0e7c42_0 
  lerc               conda-forge/osx-arm64::lerc-4.0.0-h9a09cb3_0 
  libblas            conda-forge/osx-arm64::libblas-3.9.0-22_osxarm64_openblas 
  libbrotlicommon    conda-forge/osx-arm64::libbrotlicommon-1.1.0-hb547adb_1 
  libbrotlidec       conda-forge/osx-arm64::libbrotlidec-1.1.0-hb547adb_1 
  libbrotlienc       conda-forge/osx-arm64::libbrotlienc-1.1.0-hb547adb_1 
  libcblas           conda-forge/osx-arm64::libcblas-3.9.0-22_osxarm64_openblas 
  libcxx             conda-forge/osx-arm64::libcxx-17.0.6-h5f092b4_0 
  libdeflate         conda-forge/osx-arm64::libdeflate-1.20-h93a5062_0 
  libexpat           conda-forge/osx-arm64::libexpat-2.6.2-hebf3989_0 
  libffi             conda-forge/osx-arm64::libffi-3.4.2-h3422bc3_5 
  libgfortran        conda-forge/osx-arm64::libgfortran-5.0.0-13_2_0_hd922786_3 
  libgfortran5       conda-forge/osx-arm64::libgfortran5-13.2.0-hf226fd6_3 
  libjpeg-turbo      conda-forge/osx-arm64::libjpeg-turbo-3.0.0-hb547adb_1 
  liblapack          conda-forge/osx-arm64::liblapack-3.9.0-22_osxarm64_openblas 
  libopenblas        conda-forge/osx-arm64::libopenblas-0.3.27-openmp_h6c19121_0 
  libpng             conda-forge/osx-arm64::libpng-1.6.43-h091b4b1_0 
  libsqlite          conda-forge/osx-arm64::libsqlite-3.45.3-h091b4b1_0 
  libtiff            conda-forge/osx-arm64::libtiff-4.6.0-h07db509_3 
  libwebp-base       conda-forge/osx-arm64::libwebp-base-1.4.0-h93a5062_0 
  libxcb             conda-forge/osx-arm64::libxcb-1.15-hf346824_0 
  libzlib            conda-forge/osx-arm64::libzlib-1.2.13-h53f4e23_5 
  llvm-openmp        conda-forge/osx-arm64::llvm-openmp-18.1.5-hde57baf_0 
  matplotlib-base    conda-forge/osx-arm64::matplotlib-base-3.8.4-py312h4479663_1 
  munkres            conda-forge/noarch::munkres-1.1.4-pyh9f0ad1d_0 
  ncurses            conda-forge/osx-arm64::ncurses-6.5-hb89a1cb_0 
  numpy              conda-forge/osx-arm64::numpy-2.0.0rc1-py312hb84bddb_0 
  openjpeg           conda-forge/osx-arm64::openjpeg-2.5.2-h9f1df11_0 
  openssl            conda-forge/osx-arm64::openssl-3.3.0-h0d3ecfb_0 
  packaging          conda-forge/noarch::packaging-24.0-pyhd8ed1ab_0 
  pillow             conda-forge/osx-arm64::pillow-10.3.0-py312h8a801b1_0 
  pip                conda-forge/noarch::pip-24.0-pyhd8ed1ab_0 
  pthread-stubs      conda-forge/osx-arm64::pthread-stubs-0.4-h27ca646_1001 
  pyparsing          conda-forge/noarch::pyparsing-3.1.2-pyhd8ed1ab_0 
  python             conda-forge/osx-arm64::python-3.12.3-h4a7b5fc_0_cpython 
  python-dateutil    conda-forge/noarch::python-dateutil-2.9.0-pyhd8ed1ab_0 
  python_abi         conda-forge/osx-arm64::python_abi-3.12-4_cp312 
  readline           conda-forge/osx-arm64::readline-8.2-h92ec313_1 
  setuptools         conda-forge/noarch::setuptools-69.5.1-pyhd8ed1ab_0 
  six                conda-forge/noarch::six-1.16.0-pyh6c4a22f_0 
  tk                 conda-forge/osx-arm64::tk-8.6.13-h5083fa2_1 
  tzdata             conda-forge/noarch::tzdata-2024a-h0c530f3_0 
  wheel              conda-forge/noarch::wheel-0.43.0-pyhd8ed1ab_1 
  xorg-libxau        conda-forge/osx-arm64::xorg-libxau-1.0.11-hb547adb_0 
  xorg-libxdmcp      conda-forge/osx-arm64::xorg-libxdmcp-1.1.3-h27ca646_0 
  xz                 conda-forge/osx-arm64::xz-5.2.6-h57fd34a_0 
  zstd               conda-forge/osx-arm64::zstd-1.5.6-hb46c0d2_0 



DryRunExit: Dry run. Exiting.

@hoxbro
Copy link
Member Author

hoxbro commented May 18, 2024

I have opened #6238, which tests for Numpy 2.0.

Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants