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

Updating for NumPy 2.0 #1588

Closed
andrew-s28 opened this issue Jun 17, 2024 · 7 comments · Fixed by #1589
Closed

Updating for NumPy 2.0 #1588

andrew-s28 opened this issue Jun 17, 2024 · 7 comments · Fixed by #1589

Comments

@andrew-s28
Copy link
Contributor

andrew-s28 commented Jun 17, 2024

NumPy's first major version update in years has officially released, and if one follows the parcels installation tutorial they will find themselves with NumPy v2.0.0 installed by default.

The only breaking change that I could find for parcels is the use of np.infty, which has been deprecated in favor of np.inf in NumPy 2.0.0. I haven't found any other breaking changes, and with just the changing of np.infty->np.inf, the example python example_peninsula.py --fieldset 100 100 runs without error, but I haven't done any more testing than this.

I can submit a PR and get np.infty changed easily, and it is of course backwards compatible with the current NumPy and parcels versions. I just wanted to open this issue first to start a conversation and see if anyone can find any other breaking changes in NumPy 2.0.0 (especially the NumPy C API, since I'm not well versed in the C code generation used in parcels or if it relies on NumPy at all), or if this has been thought about by others yet.

@erikvansebille
Copy link
Member

Thanks heaps for raising this issue, @andrew-s28! Yes, please go ahead and create a PR for the np.inf change.

The C code generation doesn't rely on numpy, but on ast and cgen (see codegenerator.py; it doesn't even import numpy), so should be ok

If we find other issues in the coming weeks, at least we know what the first line of investigation is :-)

@mchoblet
Copy link

also had this issue when installing via conda on linux following the parcels installation tutorial. Upgrading parcels via pip solved the issue: pip install --upgrade parcels
I then additionally also had to downgrade zarr (pip install "zarr<2.16") to not run into the "AttributeError: module 'zarr.storage' has no attribute 'Store' " issue, that is also reported here: #1329

@VeckoTheGecko
Copy link
Contributor

VeckoTheGecko commented Feb 12, 2025

@mchoblet Would you be able to recreate that process, but by providing the output of conda env export at each step so that we can have a better idea of what's happening?

I'm surprised you had to downgrade zarr since #1329 is about setting a min version (not a max version), and that zarr 2.18 is working for me.

Also surprised that installing the latest Parcels via conda didn't work out the box for you. Which version of Parcels are you installing?

@mchoblet
Copy link

Hi @VeckoTheGecko, thanks for checking in that fast.

So, I just run the following commands (as detailed here: https://docs.oceanparcels.org/en/latest/installation.html) on the cluster I am working on:

conda activate base
conda create -n parcels_test -c conda-forge parcels trajan cartopy jupyter
conda activate parcels_test
conda env export

I get:

name: parcels_test
channels:
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - anyio=4.8.0=pyhd8ed1ab_0
  - argon2-cffi=23.1.0=pyhd8ed1ab_1
  - argon2-cffi-bindings=21.2.0=py311h9ecbd09_5
  - arrow=1.3.0=pyhd8ed1ab_1
  - asttokens=3.0.0=pyhd8ed1ab_1
  - async-lru=2.0.4=pyhd8ed1ab_1
  - attrs=25.1.0=pyh71513ae_0
  - aws-c-auth=0.8.1=h205f482_0
  - aws-c-cal=0.8.1=h1a47875_3
  - aws-c-common=0.10.6=hb9d3cd8_0
  - aws-c-compression=0.3.0=h4e1184b_5
  - aws-c-event-stream=0.5.0=h7959bf6_11
  - aws-c-http=0.9.2=hefd7a92_4
  - aws-c-io=0.15.3=h173a860_6
  - aws-c-mqtt=0.11.0=h11f4f37_12
  - aws-c-s3=0.7.9=he1b24dc_1
  - aws-c-sdkutils=0.2.2=h4e1184b_0
  - aws-checksums=0.2.2=h4e1184b_4
  - aws-crt-cpp=0.29.9=he0e7f3f_2
  - aws-sdk-cpp=1.11.489=h4d475cb_0
  - azure-core-cpp=1.14.0=h5cfcd09_0
  - azure-identity-cpp=1.10.0=h113e628_0
  - azure-storage-blobs-cpp=12.13.0=h3cf044e_1
  - azure-storage-common-cpp=12.8.0=h736e048_1
  - azure-storage-files-datalake-cpp=12.12.0=ha633028_1
  - babel=2.17.0=pyhd8ed1ab_0
  - beautifulsoup4=4.13.3=pyha770c72_0
  - binutils_impl_linux-64=2.43=h4bf12b8_2
  - binutils_linux-64=2.43=h4852527_2
  - bleach=6.2.0=pyh29332c3_4
  - bleach-with-css=6.2.0=h82add2a_4
  - blosc=1.21.6=he440d0b_1
  - bokeh=3.6.3=pyhd8ed1ab_0
  - bottleneck=1.4.2=py311h9f3472d_0
  - brotli=1.1.0=hb9d3cd8_2
  - brotli-bin=1.1.0=hb9d3cd8_2
  - brotli-python=1.1.0=py311hfdbb021_2
  - bzip2=1.0.8=h4bc722e_7
  - c-ares=1.34.4=hb9d3cd8_0
  - ca-certificates=2025.1.31=hbcca054_0
  - cached-property=1.5.2=hd8ed1ab_1
  - cached_property=1.5.2=pyha770c72_1
  - cartopy=0.24.0=py311h7db5c69_0
  - certifi=2024.12.14=pyhd8ed1ab_0
  - cf_xarray=0.10.0=pyhd8ed1ab_2
  - cffi=1.17.1=py311hf29c0ef_0
  - cftime=1.6.4=py311h9f3472d_1
  - cgen=2020.1=pyhd8ed1ab_2
  - charset-normalizer=3.4.1=pyhd8ed1ab_0
  - click=8.1.8=pyh707e725_0
  - cloudpickle=3.1.1=pyhd8ed1ab_0
  - colorama=0.4.6=pyhd8ed1ab_1
  - comm=0.2.2=pyhd8ed1ab_1
  - contourpy=1.3.1=py311hd18a35c_0
  - crc32c=2.7.1=py311h9ecbd09_0
  - cycler=0.12.1=pyhd8ed1ab_1
  - cytoolz=1.0.1=py311h9ecbd09_0
  - dask=2025.1.0=pyhd8ed1ab_0
  - dask-core=2025.1.0=pyhd8ed1ab_0
  - debugpy=1.8.12=py311hfdbb021_0
  - decorator=5.1.1=pyhd8ed1ab_1
  - defusedxml=0.7.1=pyhd8ed1ab_0
  - deprecated=1.2.18=pyhd8ed1ab_0
  - distributed=2025.1.0=pyhd8ed1ab_0
  - donfig=0.8.1.post1=pyhd8ed1ab_1
  - exceptiongroup=1.2.2=pyhd8ed1ab_1
  - executing=2.1.0=pyhd8ed1ab_1
  - fonttools=4.56.0=py311h2dc5d0c_0
  - fqdn=1.5.1=pyhd8ed1ab_1
  - freetype=2.12.1=h267a509_2
  - fsspec=2025.2.0=pyhd8ed1ab_0
  - gcc_impl_linux-64=14.2.0=h6b349bd_1
  - gcc_linux-64=14.2.0=h5910c8f_7
  - geos=3.13.0=h5888daf_0
  - gflags=2.2.2=h5888daf_1005
  - glog=0.7.1=hbabe93e_0
  - h11=0.14.0=pyhd8ed1ab_1
  - h2=4.2.0=pyhd8ed1ab_0
  - hdf4=4.2.15=h2a13503_7
  - hdf5=1.14.4=nompi_h2d575fe_105
  - hpack=4.1.0=pyhd8ed1ab_0
  - httpcore=1.0.7=pyh29332c3_1
  - httpx=0.28.1=pyhd8ed1ab_0
  - hyperframe=6.1.0=pyhd8ed1ab_0
  - idna=3.10=pyhd8ed1ab_1
  - immutabledict=4.2.1=pyhd8ed1ab_1
  - importlib-metadata=8.6.1=pyha770c72_0
  - importlib_resources=6.5.2=pyhd8ed1ab_0
  - iniconfig=2.0.0=pyhd8ed1ab_1
  - ipykernel=6.29.5=pyh3099207_0
  - ipython=8.32.0=pyh907856f_0
  - ipywidgets=8.1.5=pyhd8ed1ab_1
  - isoduration=20.11.0=pyhd8ed1ab_1
  - jedi=0.19.2=pyhd8ed1ab_1
  - jinja2=3.1.5=pyhd8ed1ab_0
  - json5=0.10.0=pyhd8ed1ab_1
  - jsonpointer=3.0.0=py311h38be061_1
  - jsonschema=4.23.0=pyhd8ed1ab_1
  - jsonschema-specifications=2024.10.1=pyhd8ed1ab_1
  - jsonschema-with-format-nongpl=4.23.0=hd8ed1ab_1
  - jupyter=1.1.1=pyhd8ed1ab_1
  - jupyter-lsp=2.2.5=pyhd8ed1ab_1
  - jupyter_client=8.6.3=pyhd8ed1ab_1
  - jupyter_console=6.6.3=pyhd8ed1ab_1
  - jupyter_core=5.7.2=pyh31011fe_1
  - jupyter_events=0.12.0=pyh29332c3_0
  - jupyter_server=2.15.0=pyhd8ed1ab_0
  - jupyter_server_terminals=0.5.3=pyhd8ed1ab_1
  - jupyterlab=4.3.5=pyhd8ed1ab_0
  - jupyterlab_pygments=0.3.0=pyhd8ed1ab_2
  - jupyterlab_server=2.27.3=pyhd8ed1ab_1
  - jupyterlab_widgets=3.0.13=pyhd8ed1ab_1
  - kernel-headers_linux-64=2.6.32=he073ed8_17
  - keyutils=1.6.1=h166bdaf_0
  - kiwisolver=1.4.8=py311h6a678d5_0
  - krb5=1.21.3=h659f571_0
  - lcms2=2.17=h717163a_0
  - ld_impl_linux-64=2.43=h712a8e2_2
  - lerc=4.0.0=h27087fc_0
  - libabseil=20240722.0=cxx17_hbbce691_4
  - libaec=1.1.3=h59595ed_0
  - libarrow=19.0.0=h00a82cf_8_cpu
  - libarrow-acero=19.0.0=hcb10f89_8_cpu
  - libarrow-dataset=19.0.0=hcb10f89_8_cpu
  - libarrow-substrait=19.0.0=h08228c5_8_cpu
  - libblas=3.9.0=28_h59b9bed_openblas
  - libbrotlicommon=1.1.0=hb9d3cd8_2
  - libbrotlidec=1.1.0=hb9d3cd8_2
  - libbrotlienc=1.1.0=hb9d3cd8_2
  - libcblas=3.9.0=28_he106b2a_openblas
  - libcrc32c=1.1.2=h9c3ff4c_0
  - libcurl=8.11.1=h332b0f4_0
  - libdeflate=1.23=h4ddbbb0_0
  - libedit=3.1.20250104=pl5321h7949ede_0
  - libev=4.33=hd590300_2
  - libevent=2.1.12=hf998b51_1
  - libexpat=2.6.4=h5888daf_0
  - libffi=3.4.6=h2dba641_0
  - libgcc=14.2.0=h77fa898_1
  - libgcc-devel_linux-64=14.2.0=h41c2201_101
  - libgcc-ng=14.2.0=h69a702a_1
  - libgfortran=14.2.0=h69a702a_1
  - libgfortran5=14.2.0=hd5240d6_1
  - libgomp=14.2.0=h77fa898_1
  - libgoogle-cloud=2.34.0=h2b5623c_0
  - libgoogle-cloud-storage=2.34.0=h0121fbd_0
  - libgrpc=1.67.1=h25350d4_1
  - libiconv=1.17=hd590300_2
  - libjpeg-turbo=3.0.0=hd590300_1
  - liblapack=3.9.0=28_h7ac8fdf_openblas
  - liblzma=5.6.4=hb9d3cd8_0
  - liblzma-devel=5.6.4=hb9d3cd8_0
  - libnetcdf=4.9.2=nompi_h5ddbaa4_116
  - libnghttp2=1.64.0=h161d5f1_0
  - libnsl=2.0.1=hd590300_0
  - libopenblas=0.3.28=pthreads_h94d23a6_1
  - libopentelemetry-cpp=1.18.0=hfcad708_1
  - libopentelemetry-cpp-headers=1.18.0=ha770c72_1
  - libparquet=19.0.0=h081d1f1_8_cpu
  - libpng=1.6.46=h943b412_0
  - libprotobuf=5.28.3=h6128344_1
  - libre2-11=2024.07.02=hbbce691_2
  - libsanitizer=14.2.0=h2a3dede_1
  - libsodium=1.0.20=h4ab18f5_0
  - libsqlite=3.48.0=hee588c1_1
  - libssh2=1.11.1=hf672d98_0
  - libstdcxx=14.2.0=hc0a3c3a_1
  - libstdcxx-ng=14.2.0=h4852527_1
  - libthrift=0.21.0=h0e7cc3e_0
  - libtiff=4.7.0=hd9ff511_3
  - libutf8proc=2.10.0=h4c51ac1_0
  - libuuid=2.38.1=h0b41bf4_0
  - libwebp-base=1.5.0=h851e524_0
  - libxcb=1.17.0=h8a09558_0
  - libxcrypt=4.4.36=hd590300_1
  - libxml2=2.13.5=h0d44e9d_1
  - libzip=1.11.2=h6991a6a_0
  - libzlib=1.3.1=hb9d3cd8_2
  - locket=1.0.0=pyhd8ed1ab_0
  - lz4=4.3.3=py311h8c6ae76_2
  - lz4-c=1.10.0=h5888daf_1
  - markupsafe=3.0.2=py311h2dc5d0c_1
  - matplotlib-base=3.10.0=py311h2b939e6_0
  - matplotlib-inline=0.1.7=pyhd8ed1ab_1
  - mistune=3.1.1=pyhd8ed1ab_0
  - msgpack-python=1.1.0=py311hd18a35c_0
  - munkres=1.1.4=pyh9f0ad1d_0
  - nbclient=0.10.2=pyhd8ed1ab_0
  - nbconvert-core=7.16.6=pyh29332c3_0
  - nbformat=5.10.4=pyhd8ed1ab_1
  - ncurses=6.5=h2d0b736_3
  - nest-asyncio=1.6.0=pyhd8ed1ab_1
  - netcdf4=1.7.2=nompi_py311h7c29e4f_101
  - nlohmann_json=3.11.3=he02047a_1
  - notebook=7.3.2=pyhd8ed1ab_0
  - notebook-shim=0.2.4=pyhd8ed1ab_1
  - numcodecs=0.15.1=py311h7db5c69_0
  - numpy=2.2.2=py311h5d046bc_0
  - openjpeg=2.5.3=h5fbd93e_0
  - openssl=3.4.1=h7b32b05_0
  - orc=2.0.3=h12ee42a_2
  - overrides=7.7.0=pyhd8ed1ab_1
  - packaging=24.2=pyhd8ed1ab_2
  - pandas=2.2.2=py311h14de704_1
  - pandocfilters=1.5.0=pyhd8ed1ab_0
  - parcels=2.4.2=py311h38be061_1
  - parso=0.8.4=pyhd8ed1ab_1
  - partd=1.4.2=pyhd8ed1ab_0
  - pexpect=4.9.0=pyhd8ed1ab_1
  - pickleshare=0.7.5=pyhd8ed1ab_1004
  - pillow=11.1.0=py311h1322bbf_0
  - pip=25.0.1=pyh8b19718_0
  - pkgutil-resolve-name=1.3.10=pyhd8ed1ab_2
  - platformdirs=4.3.6=pyhd8ed1ab_1
  - pluggy=1.5.0=pyhd8ed1ab_1
  - proj=9.5.1=h0054346_0
  - prometheus-cpp=1.3.0=ha5d0236_0
  - prometheus_client=0.21.1=pyhd8ed1ab_0
  - prompt-toolkit=3.0.50=pyha770c72_0
  - prompt_toolkit=3.0.50=hd8ed1ab_0
  - psutil=6.1.1=py311h9ecbd09_0
  - pthread-stubs=0.4=hb9d3cd8_1002
  - ptyprocess=0.7.0=pyhd8ed1ab_1
  - pure_eval=0.2.3=pyhd8ed1ab_1
  - pyarrow=19.0.0=py311h38be061_0
  - pyarrow-core=19.0.0=py311h4854187_0_cpu
  - pycparser=2.22=pyh29332c3_1
  - pygments=2.19.1=pyhd8ed1ab_0
  - pymbolic=2024.2.2=pyhecae5ae_0
  - pyparsing=3.2.1=pyhd8ed1ab_0
  - pyproj=3.7.0=py311h0f98d5a_0
  - pyshp=2.3.1=pyhd8ed1ab_1
  - pysocks=1.7.1=pyha55dd90_7
  - pytest=8.3.4=pyhd8ed1ab_1
  - python=3.11.11=h9e4cc4f_1_cpython
  - python-dateutil=2.9.0.post0=pyhff2d567_1
  - python-fastjsonschema=2.21.1=pyhd8ed1ab_0
  - python-json-logger=2.0.7=pyhd8ed1ab_0
  - python-tzdata=2025.1=pyhd8ed1ab_0
  - python_abi=3.11=5_cp311
  - pytools=2025.1.1=pyhd8ed1ab_0
  - pytz=2025.1=pyhd8ed1ab_0
  - pyyaml=6.0.2=py311h2dc5d0c_2
  - pyzmq=26.2.1=py311h7deb3e3_0
  - qhull=2020.2=h434a139_5
  - re2=2024.07.02=h9925aae_2
  - readline=8.2=h8228510_1
  - referencing=0.36.2=pyh29332c3_0
  - requests=2.32.3=pyhd8ed1ab_1
  - rfc3339-validator=0.1.4=pyhd8ed1ab_1
  - rfc3986-validator=0.1.1=pyh9f0ad1d_0
  - roaring-landmask=0.9.2=py311ha8c6e60_0
  - rpds-py=0.22.3=py311h9e33e62_0
  - s2n=1.5.11=h072c03f_0
  - scipy=1.15.1=py311hc1ac118_0
  - send2trash=1.8.3=pyh0d859eb_1
  - setuptools=75.8.0=pyhff2d567_0
  - shapely=2.0.7=py311h2fdb869_0
  - siphash24=1.7=py311h9ecbd09_0
  - six=1.17.0=pyhd8ed1ab_0
  - snappy=1.2.1=h8bd8927_1
  - sniffio=1.3.1=pyhd8ed1ab_1
  - sortedcontainers=2.4.0=pyhd8ed1ab_1
  - soupsieve=2.5=pyhd8ed1ab_1
  - sqlite=3.48.0=h9eae976_1
  - stack_data=0.6.3=pyhd8ed1ab_1
  - sysroot_linux-64=2.12=he073ed8_17
  - tblib=3.0.0=pyhd8ed1ab_1
  - terminado=0.18.1=pyh0d859eb_0
  - tinycss2=1.4.0=pyhd8ed1ab_0
  - tk=8.6.13=noxft_h4845f30_101
  - tomli=2.2.1=pyhd8ed1ab_1
  - toolz=1.0.0=pyhd8ed1ab_1
  - tornado=6.4.2=py311h9ecbd09_0
  - tqdm=4.67.1=pyhd8ed1ab_1
  - traitlets=5.14.3=pyhd8ed1ab_1
  - trajan=0.7.0=pyhd8ed1ab_1
  - types-python-dateutil=2.9.0.20241206=pyhd8ed1ab_0
  - typing-extensions=4.12.2=hd8ed1ab_1
  - typing_extensions=4.12.2=pyha770c72_1
  - typing_utils=0.1.0=pyhd8ed1ab_1
  - tzdata=2025a=h78e105d_0
  - unicodedata2=16.0.0=py311h9ecbd09_0
  - uri-template=1.3.0=pyhd8ed1ab_1
  - urllib3=2.3.0=pyhd8ed1ab_0
  - wcwidth=0.2.13=pyhd8ed1ab_1
  - webcolors=24.11.1=pyhd8ed1ab_0
  - webencodings=0.5.1=pyhd8ed1ab_3
  - websocket-client=1.8.0=pyhd8ed1ab_1
  - wheel=0.45.1=pyhd8ed1ab_1
  - widgetsnbextension=4.0.13=pyhd8ed1ab_1
  - wrapt=1.17.2=py311h9ecbd09_0
  - xarray=2025.1.2=pyhd8ed1ab_0
  - xorg-libxau=1.0.12=hb9d3cd8_0
  - xorg-libxdmcp=1.1.5=hb9d3cd8_0
  - xyzservices=2025.1.0=pyhd8ed1ab_0
  - xz=5.6.4=hbcc6ac9_0
  - xz-gpl-tools=5.6.4=hbcc6ac9_0
  - xz-tools=5.6.4=hb9d3cd8_0
  - yaml=0.2.5=h7f98852_2
  - zarr=3.0.2=pyhd8ed1ab_0
  - zeromq=4.3.5=h3b0a872_7
  - zict=3.0.0=pyhd8ed1ab_1
  - zipp=3.21.0=pyhd8ed1ab_1
  - zlib=1.3.1=hb9d3cd8_2
  - zstandard=0.23.0=py311hbc35293_1
  - zstd=1.5.6=ha6fb4c9_0
prefix: /gpfs/home/acad/ulg-mast/mchoblet/.conda/envs/parcels_test

So I do in fact get the older parcels version 2.4.2 (as listed here for linux-64: https://anaconda.org/conda-forge/parcels), as well as the zarr version 3.0.2

Hope this is somehow useful for you, or would it be even better if I install each package separately and give you the env export at each step?

@VeckoTheGecko
Copy link
Contributor

VeckoTheGecko commented Feb 12, 2025

@mchoblet Huh, strange! Not sure why its pulling 2.4.2 and not the latest version. Running your commands it isn't doing that on my machine. Can you try?

conda create -n parcels_test -c conda-forge parcels=3.1.2 trajan cartopy jupyter

Just a note that installing older versions of Parcels might run into dependency incompatibility like this (unless you manually specify the dependency versions). This is just the nature of installing old packages, as the scientific python sphere advances.

Let me know if that helps! (/what that says)

@mchoblet
Copy link

mchoblet commented Feb 12, 2025

That command does pull the latest version of parcels correctly, and it also pulls an older version of zarr (2.18).
I also have no idea why it is doing that on the cluster I am working on, I didn't think at all about which version I was downloading at first, of course I want to have the freshest version :)

I tried on my personal laptop, and that pulled the right version of parcels without specifying the version. Maybe its because of the Anaconda version (2022.05) that is installed on the cluster? I don't know much about what conda is doing in the background...

@VeckoTheGecko
Copy link
Contributor

also pulls an older version of zarr (2.18)

We don't have support for v3 yet, so this makes sense. v3 was only quite recently released as well.

Maybe its because of the Anaconda version (2022.05) that is installed on the cluster? I don't know much about what conda is doing in the background...

I'm not sure - perhaps something to bring up with your sysadmins :)

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

Successfully merging a pull request may close this issue.

4 participants