Stream: python-questions

Topic: pop-tools error after package updates


view this post on Zulip Mira Berdahl (Jan 18 2024 at 19:39):

It looks like after updating some of my packages, pop-tools breaks. It worked well before this update, and appears to be related a deprecated np.float() call. Any plans to update the pop-tools package? Or other workaround recommendations?

When trying to get the grid:

grid_name = 'POP_tx0.1v3'  # our 0.1 degree pop grid.
grid = pop_tools.get_grid(grid_name)

The following error is thrown:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [4], in <module>
      1 # using pop tools, get the region mask.
      2 grid_name = 'POP_tx0.1v3'  # our 0.1 degree pop grid.
----> 3 grid = pop_tools.get_grid(grid_name)

File /glade/work/mberdahl/miniconda/envs/pangeo/lib/python3.9/site-packages/pop_tools/grid.py:142, in get_grid(grid_name, scrip)
    139 grid_file_data = np.fromfile(horiz_grid_fname, dtype='>f8', count=-1)
    140 grid_file_data = grid_file_data.reshape((7, nlat, nlon))
--> 142 ULAT = grid_file_data[0, :, :].astype(np.float)
    143 ULONG = grid_file_data[1, :, :].astype(np.float)
    144 HTN = grid_file_data[2, :, :].astype(np.float)

File /glade/work/mberdahl/miniconda/envs/pangeo/lib/python3.9/site-packages/numpy/__init__.py:324, in __getattr__(attr)
    319     warnings.warn(
    320         f"In the future `np.{attr}` will be defined as the "
    321         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    323 if attr in __former_attrs__:
--> 324     raise AttributeError(__former_attrs__[attr])
    326 if attr == 'testing':
    327     import numpy.testing as testing

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

view this post on Zulip Katelyn FitzGerald (Jan 18 2024 at 22:28):

It looks like this might have been updated in the last release 2023.06.0 (https://github.com/NCAR/pop-tools). Do you know what version of pop-tools you're using?

I'm not sure on the maintainer question - curious myself.

view this post on Zulip Mira Berdahl (Jan 18 2024 at 23:11):

Well, I had pop-tools version 2021.5.28.
I just upgraded it, but now I am encountering the following error when importing cartopy

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [1], in <module>
      2 import xarray as xr
      3 #from matplotlib import pyplot as plt
----> 4 import cartopy.crs as ccrs
      5 import nc_time_axis as nc_time_axis
      6 import cmocean

File /glade/work/mberdahl/miniconda/envs/pangeo/lib/python3.9/site-packages/cartopy/__init__.py:107, in <module>
    102     pass
    105 # Commonly used sub-modules. Imported here to provide end-user
    106 # convenience.
--> 107 import cartopy.crs
    108 import cartopy.feature

File /glade/work/mberdahl/miniconda/envs/pangeo/lib/python3.9/site-packages/cartopy/crs.py:23, in <module>
     21 import numpy as np
     22 import shapely.geometry as sgeom
---> 23 from pyproj import Transformer
     24 from pyproj.exceptions import ProjError
     25 from shapely.prepared import prep

File /glade/work/mberdahl/miniconda/envs/pangeo/lib/python3.9/site-packages/pyproj/__init__.py:49, in <module>
     32 __all__ = [
     33     "Proj",
     34     "Geod",
   (...)
     45     "show_versions",
     46 ]
     47 import warnings
---> 49 import pyproj.network
     50 from pyproj._datadir import (  # noqa: F401 pylint: disable=unused-import
     51     _pyproj_global_context_initialize,
     52     set_use_global_context,
     53 )
     54 from pyproj._show_versions import (  # noqa: F401 pylint: disable=unused-import
     55     show_versions,
     56 )

File /glade/work/mberdahl/miniconda/envs/pangeo/lib/python3.9/site-packages/pyproj/network.py:10, in <module>
      6 from typing import Union
      8 import certifi
---> 10 from pyproj._network import (  # noqa: F401 pylint: disable=unused-import
     11     _set_ca_bundle_path,
     12     is_network_enabled,
     13     set_network_enabled,
     14 )
     17 def set_ca_bundle_path(ca_bundle_path: Union[Path, str, bool, None] = None) -> None:
     18     """
     19     .. versionadded:: 3.0.0
     20
   (...)
     38         variables.
     39     """

ImportError: libcrypto.so.3: cannot open shared object file: No such file or directory

view this post on Zulip Katelyn FitzGerald (Jan 18 2024 at 23:52):

It looks like the system you're working on doesn't have the right version of openssl/libcrypto.so.3. Is this on casper? Might be worth looping in the HPC folks if so.

view this post on Zulip Mira Berdahl (Jan 19 2024 at 17:17):

Thanks @Katelyn FitzGerald , will do.
This is on casper, yes.


Last updated: May 16 2025 at 17:14 UTC