You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unsure action is required on this but I thought it might be nice to know.
I have just installed argopy 1.0.0 in a relatively fresh conda env. On import I received an error traceback to xarray having to do with calling np.unicode_ as it was deprecated in numpy 2.0. I then installed/re-installed xarray which downgraded numpy from 2.1.2 to 1.26.4 and solved the issue. Worth noting I had a similar issue with another package and numpy earlier.
---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
CellIn[1], line1---->1importargopyFile~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\argopy\__init__.py:2522log.addHandler(logging.NullHandler())
24# Import facades:--->25from .fetchersimportArgoDataFetcherasDataFetcher# noqa: E40226from .fetchersimportArgoIndexFetcherasIndexFetcher# noqa: E40228from .xarrayimportArgoAccessor# noqa: E402File~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\argopy\fetchers.py:1412importos13importwarnings--->14importxarrayasxr15importpandasaspd16importnumpyasnpFile~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\xarray\__init__.py:1---->1from . importtesting, tutorial, ufuncs2from .backends.apiimport (
3load_dataarray,
4load_dataset,
(...)
8save_mfdataset,
9 )
10from .backends.rasterio_importopen_rasterioFile~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\xarray\testing.py:84fromtypingimportHashable, Set, Union6importnumpyasnp---->8fromxarray.coreimportduck_array_ops, formatting, utils9fromxarray.core.dataarrayimportDataArray10fromxarray.core.datasetimportDatasetFile~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\xarray\core\duck_array_ops.py:2421fromnumpyimporttake, tensordot, transpose, unravel_index# noqa22fromnumpyimportwhereas_where--->24from . importdask_array_compat, dask_array_ops, dtypes, npcompat, nputils25from .nputilsimportnanfirst, nanlast26from .pycompatimport (
27cupy_array_type,
28dask_array_type,
(...)
31sparse_version,
32 )
File~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\xarray\core\dask_array_ops.py:1---->1from . importdtypes, nputils4defdask_rolling_wrapper(moving_func, a, window, min_count=None, axis=-1):
5"""Wrapper to apply bottleneck moving window funcs on dask arrays"""File~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\xarray\core\dtypes.py:4131NINF=AlwaysLessThan()
34# Pairs of types that, if both found, should be promoted to object dtype35# instead of following NumPy's own type-promotion rules. These type promotion36# rules match pandas instead. For reference, see the NumPy type hierarchy:37# https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.scalars.html38PROMOTE_TO_OBJECT= [
39 {np.number, np.character}, # numpy promotes to character40 {np.bool_, np.character}, # numpy promotes to character--->41 {np.bytes_, np.unicode_}, # numpy promotes to unicode42 ]
45defmaybe_promote(dtype):
46"""Simpler equivalent of pandas.core.common._maybe_promote 47 48 Parameters (...) 55 fill_value : Valid missing value for the promoted dtype. 56 """File~\AppData\Local\anaconda3\envs\admt25\Lib\site-packages\numpy\__init__.py:400, in__getattr__(attr)
397raiseAttributeError(__former_attrs__[attr], name=None)
399ifattrin__expired_attributes__:
-->400raiseAttributeError(
401f"`np.{attr}` was removed in the NumPy 2.0 release. "402f"{__expired_attributes__[attr]}",
403name=None404 )
406ifattr=="chararray":
407warnings.warn(
408"`np.chararray` is deprecated and will be removed from "409"the main namespace in the future. Use an array with a string "410"or bytes dtype instead.", DeprecationWarning, stacklevel=2)
AttributeError: `np.unicode_`wasremovedintheNumPy2.0release. Use`np.str_`instead.
conda install -c conda-forge xarray
Channels:
- conda-forge
- defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\gordonc\AppData\Local\anaconda3\envs\admt25
added / updated specs:
- xarray
The following packages will be downloaded:
package | build
---------------------------|-----------------
numpy-1.26.4 | py312h8753938_0 6.2 MB conda-forge
xarray-2024.2.0 | pyhd8ed1ab_0 724 KB conda-forge
------------------------------------------------------------
Total: 6.9 MB
The following packages will be UPDATED:
xarray pkgs/main::xarray-0.20.1-pyhd3eb1b0_1 --> conda-forge::xarray-2024.2.0-pyhd8ed1ab_0
The following packages will be DOWNGRADED:
numpy 2.1.2-py312hf10105a_0 --> 1.26.4-py312h8753938_0
Proceed ([y]/n)? y
Downloading and Extracting Packages:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Thanks @cgrdn for reporting this
Indeed we cannot work yet with numpy 2 because of #390 requiring to pin xarray to version older than 2024.3
as soon as this will be fixed, will be able to unconstraint and work with numpy 2
I am unsure action is required on this but I thought it might be nice to know.
I have just installed argopy 1.0.0 in a relatively fresh conda env. On import I received an error traceback to xarray having to do with calling
np.unicode_
as it was deprecated in numpy 2.0. I then installed/re-installed xarray which downgraded numpy from 2.1.2 to 1.26.4 and solved the issue. Worth noting I had a similar issue with another package and numpy earlier.MCVE Code Sample
conda install -c conda-forge argopy
conda install -c conda-forge xarray
Success!
Expected Output
Successful import, which was achieved.
Problem Description
Version specification in requirements.txt?
Versions
I only ran this after solving.
The text was updated successfully, but these errors were encountered: