Unidata / cftime

Time-handling functionality from netcdf4-python.
https://unidata.github.io/cftime
MIT License
74 stars 39 forks source link

PyPI release pulls numpy 2.0.0rc1 for python 3.12 #327

Open anissa111 opened 4 months ago

anissa111 commented 4 months ago

Hi folks,

I'm seeing something a bit strange on geocat-comp logs. For python 3.12 only, cftime seems to be pulling the numpy release candidate by default.

From https://github.com/NCAR/geocat-comp/issues/598:

For python 3.11, cftime pulls numpy>1.13.3 (log)

Collecting numpy>1.13.3 (from cftime->geocat-comp)
Downloading numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)

For python 3.12, though (log):

Collecting numpy>=1.26.0b1 (from cftime->geocat-comp)
Downloading numpy-2.0.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
ocefpaf commented 4 months ago

Pip should not install a pre-release candidate without explicitly asked to. Maybe you are hitting this issue: https://github.com/pypa/pip/issues/7579

anissa111 commented 4 months ago

Right, but the workflow of our actions haven't changed.

Locally (mac-os) on a fresh environment, here's what I see.

(base) ➜  ~ conda create -n temp-cftime python=3.12
Retrieving notices: ...working... done
Channels:
 - conda-forge
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
    current version: 24.1.1
    latest version: 24.3.0

Please update conda by running

    $ conda update -n base -c conda-forge conda

## Package Plan ##

  environment location: /Users/anissaz/miniconda3/envs/temp-cftime

  added / updated specs:
    - python=3.12

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libsqlite-3.45.3           |       h091b4b1_0         805 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         805 KB

The following NEW packages will be INSTALLED:

  bzip2              conda-forge/osx-arm64::bzip2-1.0.8-h93a5062_5
  ca-certificates    conda-forge/osx-arm64::ca-certificates-2024.2.2-hf0a4a13_0
  libexpat           conda-forge/osx-arm64::libexpat-2.6.2-hebf3989_0
  libffi             conda-forge/osx-arm64::libffi-3.4.2-h3422bc3_5
  libsqlite          conda-forge/osx-arm64::libsqlite-3.45.3-h091b4b1_0
  libzlib            conda-forge/osx-arm64::libzlib-1.2.13-h53f4e23_5
  ncurses            conda-forge/osx-arm64::ncurses-6.4.20240210-h078ce10_0
  openssl            conda-forge/osx-arm64::openssl-3.2.1-h0d3ecfb_1
  pip                conda-forge/noarch::pip-24.0-pyhd8ed1ab_0
  python             conda-forge/osx-arm64::python-3.12.3-h4a7b5fc_0_cpython
  readline           conda-forge/osx-arm64::readline-8.2-h92ec313_1
  setuptools         conda-forge/noarch::setuptools-69.5.1-pyhd8ed1ab_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
  xz                 conda-forge/osx-arm64::xz-5.2.6-h57fd34a_0

Proceed ([y]/n)?

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate temp-cftime
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) ➜  ~ conda activate temp-cftime
(temp-cftime) ➜  ~ pip install cftime
Collecting cftime
  Using cached cftime-1.6.3-cp312-cp312-macosx_11_0_arm64.whl.metadata (8.6 kB)
Collecting numpy>=1.26.0b1 (from cftime)
  Downloading numpy-2.0.0rc1-cp312-cp312-macosx_14_0_arm64.whl.metadata (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.9/60.9 kB 580.7 kB/s eta 0:00:00
Using cached cftime-1.6.3-cp312-cp312-macosx_11_0_arm64.whl (221 kB)
Downloading numpy-2.0.0rc1-cp312-cp312-macosx_14_0_arm64.whl (5.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.0/5.0 MB 457.8 kB/s eta 0:00:00
Installing collected packages: numpy, cftime
Successfully installed cftime-1.6.3 numpy-2.0.0rc1
ocefpaf commented 4 months ago

Right, but the workflow of our actions haven't changed.

Yep. That is why I believe you are hitting that bug I mentioned above.

valeriupredoi commented 4 months ago

unless you are specifically testing for the installation of cftime from PyPI inside a barebones conda env, I'd go with installing cftime from conda-forge - always a lot more consistent a process when inside an already-built conda env, plus you don't run into pip-related discontinuities, and wheel-building issues :+1: @ocefpaf great pointer to that issue, cheers! I came here to see if there's any new release that includes #319 and I leave with yet another useful bit of info :beer: