Skip to content

AttributeError: module 'numpy' has no attribute '_no_nep50_warning' #5

@IFenton

Description

@IFenton

The code in how-to-use-scivision.ipynb currently crashes, both in binder and on a local version at the load_pretrained_model function. Binder gives the following AttributeError (in the local version, the kernel just crashes).

Screenshot 2023-01-10 at 15 30 50
Screenshot 2023-01-10 at 15 31 39

Full error

2023-01-10 15:09:23.308397: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-10 15:09:23.854424: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2023-01-10 15:09:23.854467: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-01-10 15:09:25.093303: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2023-01-10 15:09:25.093587: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2023-01-10 15:09:25.093610: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [4], line 2
      1 # Note: when loading this model repo for the first time you'll need to add the allow_install=True flag
----> 2 resnet_model = load_pretrained_model(model_repo, model_selection='resnet18', allow_install=True)
      3 densenet_model = load_pretrained_model(model_repo, model_selection='densenet121')

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scivision/koala.py:57, in koala.<locals>.wrapped_fn(*args, **kwargs)
     55 # now call the function, but log any exceptions
     56 try:
---> 57     output = fn(*args, **kwargs)
     58 except Exception as e:
     59     logger.error(e)

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scivision/io/reader.py:176, in load_pretrained_model(path, branch, allow_install, model_selection, load_multiple, *args, **kwargs)
    173     # try to install the package if necessary
    174     install_package(config, allow_install=allow_install, branch=branch)
--> 176     loaded_models.append(PretrainedModel(config))
    177 if load_multiple:
    178     return loaded_models

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scivision/io/wrapper.py:14, in PretrainedModel.__init__(self, config)
     12 def __init__(self, config: dict):
     13     self._config = config
---> 14     self._plumbing = AutoPlumber(config)

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scivision/io/autoplumber.py:33, in AutoPlumber.__init__(self, config)
     30 def __init__(self, config: dict):
     31 
     32     # import the module and get the model object
---> 33     self._module = importlib.import_module(config["import"])
     34     model = getattr(self._module, config["model"])
     36     # we could instantiate the model using the args here
     37     # args = config["args"]

File /srv/conda/envs/notebook/lib/python3.9/importlib/__init__.py:127, in import_module(name, package)
    125             break
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File <frozen importlib._bootstrap>:1030, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:680, in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:850, in exec_module(self, module)

File <frozen importlib._bootstrap>:228, in _call_with_frames_removed(f, *args, **kwds)

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scivision_classifier/__init__.py:1
----> 1 from .model import vgg16
      2 from .model import vgg19
      3 from .model import resnet18

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scivision_classifier/model.py:4
      2 from classification_models.tfkeras import Classifiers
      3 from skimage.filters import gaussian
----> 4 from skimage.transform import resize
      5 from tensorflow.keras.applications.imagenet_utils import decode_predictions
      8 def tidy_predict(self, image: np.ndarray) -> str:

File /srv/conda/envs/notebook/lib/python3.9/site-packages/skimage/transform/__init__.py:4
      1 from .hough_transform import (hough_line, hough_line_peaks,
      2                               probabilistic_hough_line, hough_circle,
      3                               hough_circle_peaks, hough_ellipse)
----> 4 from .radon_transform import (radon, iradon, iradon_sart,
      5                               order_angles_golden_ratio)
      6 from .finite_radon_transform import frt2, ifrt2
      7 from .integral import integral_image, integrate

File /srv/conda/envs/notebook/lib/python3.9/site-packages/skimage/transform/radon_transform.py:3
      1 import numpy as np
----> 3 from scipy.interpolate import interp1d
      4 from scipy.constants import golden_ratio
      5 from scipy.fft import fft, ifft, fftfreq, fftshift

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/interpolate/__init__.py:167
      1 """
      2 ========================================
      3 Interpolation (:mod:`scipy.interpolate`)
   (...)
    165 (should not be used in new code).
    166 """
--> 167 from ._interpolate import *
    168 from ._fitpack_py import *
    170 # New interface to fitpack library:

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/interpolate/_interpolate.py:12
      9 from scipy.special import comb
     10 from scipy._lib._util import prod
---> 12 from . import _fitpack_py
     13 from . import dfitpack
     14 from . import _fitpack

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/interpolate/_fitpack_py.py:10
      8 from ._fitpack_impl import bisplrep, bisplev, dblint
      9 from . import _fitpack_impl as _impl
---> 10 from ._bsplines import BSpline
     13 def splprep(x, w=None, u=None, ub=None, ue=None, k=3, task=0, s=None, t=None,
     14             full_output=0, nest=None, per=0, quiet=1):
     15     """
     16     Find the B-spline representation of an N-D curve.
     17 
   (...)
    151 
    152     """

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/interpolate/_bsplines.py:8
      4 from numpy.core.multiarray import normalize_axis_index
      5 from scipy.linalg import (get_lapack_funcs, LinAlgError,
      6                           cholesky_banded, cho_solve_banded,
      7                           solve, solve_banded)
----> 8 from scipy.optimize import minimize_scalar
      9 from . import _bspl
     10 from . import _fitpack_impl

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/optimize/__init__.py:405
      1 """
      2 =====================================================
      3 Optimization and root finding (:mod:`scipy.optimize`)
   (...)
    401 
    402 """
    404 from ._optimize import *
--> 405 from ._minimize import *
    406 from ._root import *
    407 from ._root_scalar import *

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/optimize/_minimize.py:26
     24 from ._trustregion_krylov import _minimize_trust_krylov
     25 from ._trustregion_exact import _minimize_trustregion_exact
---> 26 from ._trustregion_constr import _minimize_trustregion_constr
     28 # constrained minimization
     29 from ._lbfgsb_py import _minimize_lbfgsb

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/optimize/_trustregion_constr/__init__.py:4
      1 """This module contains the equality constrained SQP solver."""
----> 4 from .minimize_trustregion_constr import _minimize_trustregion_constr
      6 __all__ = ['_minimize_trustregion_constr']

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py:5
      3 from scipy.sparse.linalg import LinearOperator
      4 from .._differentiable_functions import VectorFunction
----> 5 from .._constraints import (
      6     NonlinearConstraint, LinearConstraint, PreparedConstraint, strict_bounds)
      7 from .._hessian_update_strategy import BFGS
      8 from .._optimize import OptimizeResult

File /srv/conda/envs/notebook/lib/python3.9/site-packages/scipy/optimize/_constraints.py:8
      6 from ._optimize import OptimizeWarning
      7 from warnings import warn, catch_warnings, simplefilter
----> 8 from numpy.testing import suppress_warnings
      9 from scipy.sparse import issparse
     12 def _arr_to_scalar(x):
     13     # If x is a numpy array, return x.item().  This will
     14     # fail if the array has more than one element.

File /srv/conda/envs/notebook/lib/python3.9/site-packages/numpy/testing/__init__.py:11
      8 from unittest import TestCase
     10 from . import _private
---> 11 from ._private.utils import *
     12 from ._private.utils import (_assert_valid_refcount, _gen_alignment_data)
     13 from ._private import extbuild, decorators as dec

File /srv/conda/envs/notebook/lib/python3.9/site-packages/numpy/testing/_private/utils.py:480
    476         pprint.pprint(desired, msg)
    477         raise AssertionError(msg.getvalue())
--> 480 @np._no_nep50_warning()
    481 def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
    482     """
    483     Raises an AssertionError if two items are not equal up to desired
    484     precision.
   (...)
    548 
    549     """
    550     __tracebackhide__ = True  # Hide traceback for py.test

File /srv/conda/envs/notebook/lib/python3.9/site-packages/numpy/__init__.py:311, in __getattr__(attr)
    300 """
    301 Quick sanity checks for common bugs caused by environment.
    302 There are some cases e.g. with wrong BLAS ABI that cause wrong
   (...)
    308 
    309 """
    310 try:
--> 311     x = ones(2, dtype=float32)
    312     if not abs(x.dot(x) - float32(2.0)) < 1e-5:
    313         raise AssertionError()

AttributeError: module 'numpy' has no attribute '_no_nep50_warning'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions