home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1876657858

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1876657858 I_kwDOAMm_X85v24bC 8133 AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead 23487320 closed 0     1 2023-09-01T03:34:15Z 2023-09-11T03:55:53Z 2023-09-11T03:55:53Z CONTRIBUTOR      

What happened?

We've been getting this AttributeError on PyGMT's dev CI which tests nightly packages of numpy/xarray/etc. See https://github.com/GenericMappingTools/pygmt/actions/runs/6043991082/job/16401918043#step:16:40

What did you expect to happen?

Running import xarray as xr should work with numpy 2.0.

Minimal Complete Verifiable Example

```Python mamba create --name xr_with_np2 python=3.11 mamba activate xr_with_np2 python -m pip install --pre --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy pandas xarray

python -c "import xarray as xr" ```

MVCE confirmation

  • [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [X] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [X] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [X] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

Python Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/__init__.py", line 1, in <module> from xarray import testing, tutorial File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/testing.py", line 10, in <module> from xarray.core import duck_array_ops, formatting, utils File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/core/duck_array_ops.py", line 36, in <module> from xarray.core import dask_array_ops, dtypes, nputils File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/core/dask_array_ops.py", line 3, in <module> from xarray.core import dtypes, nputils File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/xarray/core/dtypes.py", line 43, in <module> (np.bytes_, np.unicode_), # numpy promotes to unicode ^^^^^^^^^^^ File "/home/user/mambaforge/envs/xr_with_np2/lib/python3.11/site-packages/numpy/__init__.py", line 372, in __getattr__ raise AttributeError( AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.

Anything else we need to know?

See https://numpy.org/devdocs/release/2.0.0-notes.html#numpy-2-0-python-api-removals. Relevant code at xarray is here https://github.com/pydata/xarray/blob/1043a9e13574e859ec08d19425341b2e359d2802/xarray/core/dtypes.py#L36-L44

Environment

``` # packages in environment at /home/weiji/mambaforge/envs/xr_with_np2: # # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge bzip2 1.0.8 h7f98852_4 conda-forge ca-certificates 2023.7.22 hbcca054_0 conda-forge ld_impl_linux-64 2.40 h41732ed_0 conda-forge libexpat 2.5.0 hcb278e6_1 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 13.1.0 he5830b7_0 conda-forge libgomp 13.1.0 he5830b7_0 conda-forge libnsl 2.0.0 h7f98852_0 conda-forge libsqlite 3.43.0 h2797004_0 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libzlib 1.2.13 hd590300_5 conda-forge ncurses 6.4 hcb278e6_0 conda-forge numpy 2.0.0.dev0 pypi_0 pypi openssl 3.1.2 hd590300_0 conda-forge packaging 23.1 pypi_0 pypi pandas 2.2.0.dev0+141.g413d92d471 pypi_0 pypi pip 23.2.1 pyhd8ed1ab_0 conda-forge python 3.11.5 hab00c5b_0_cpython conda-forge python-dateutil 2.8.2 pypi_0 pypi pytz 2023.3 pypi_0 pypi readline 8.2 h8228510_1 conda-forge setuptools 68.1.2 pyhd8ed1ab_0 conda-forge six 1.16.0 pypi_0 pypi tk 8.6.12 h27826a3_0 conda-forge tzdata 2023.3 pypi_0 pypi wheel 0.41.2 pyhd8ed1ab_0 conda-forge xarray 2023.8.1.dev7+g1043a9e1 pypi_0 pypi xz 5.2.6 h166bdaf_0 conda-forge ```
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8133/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.628ms · About: xarray-datasette