Home > Back-end >  AttributeError: 'MachArLike' object has no attribute 'smallest_subnormal'
AttributeError: 'MachArLike' object has no attribute 'smallest_subnormal'

Time:03-22

If I import RidgeClassifierCV

from sklearn.linear_model import RidgeClassifierCV

I get the Error above. I know this is the same issue as in this post: AttributeError: 'MachAr' object has no attribute 'smallest_subnormal' But I already downgraded numpy to numpy==1.18.0 and it still is not working. So how can I fix this?

Here is the full traceback:

[autoreload of numpy.core.overrides failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\overrides.py", line 16, in <module>
    add_docstring(
RuntimeError: implement_array_function method already has a different docstring
]
[autoreload of numpy.core.multiarray failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\multiarray.py", line 78, in <module>
    def empty_like(prototype, dtype=None, order=None, subok=None, shape=None):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\overrides.py", line 224, in decorator
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\overrides.py", line 188, in decorator
    exec(source_object, scope)
RuntimeError: empty_like method already has a different docstring
]
[autoreload of numpy.core.fromnumeric failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\fromnumeric.py", line 16, in <module>
    from ._asarray import asarray, array, asanyarray
ImportError: cannot import name 'asarray' from 'numpy.core._asarray' (C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\_asarray.py)
]
[autoreload of numpy.core.numeric failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\numeric.py", line 14, in <module>
    from .multiarray import (
ImportError: cannot import name 'int_asbuffer' from 'numpy.core.multiarray' (C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\multiarray.py)
]
[autoreload of numpy.lib.scimath failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 410, in superreload
    update_generic(old_obj, new_obj)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 347, in update_generic
    update(a, b)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 266, in update_function
    setattr(old, name, getattr(new, name))
ValueError: sqrt() requires a code object with 3 free vars, not 0
]
[autoreload of numpy.linalg.linalg failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\linalg\linalg.py", line 93, in <module>
    _linalg_error_extobj = _determine_error_states()
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\linalg\linalg.py", line 86, in _determine_error_states
    with errstate(invalid='call', over='ignore',
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\_ufunc_config.py", line 432, in __enter__
ValueError: Only callable can be used as callback
]
[autoreload of numpy.linalg failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 410, in superreload
    update_generic(old_obj, new_obj)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 347, in update_generic
    update(a, b)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 266, in update_function
    setattr(old, name, getattr(new, name))
ValueError: matrix_power() requires a code object with 3 free vars, not 0
]
[autoreload of numpy.matrixlib failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\matrixlib\__init__.py", line 8, in <module>
    __all__ = defmatrix.__all__
NameError: name 'defmatrix' is not defined
]
[autoreload of numpy.lib failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\lib\__init__.py", line 47, in <module>
    __all__  = type_check.__all__
NameError: name 'type_check' is not defined
]
[autoreload of numpy.fft failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 410, in superreload
    update_generic(old_obj, new_obj)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 347, in update_generic
    update(a, b)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 266, in update_function
    setattr(old, name, getattr(new, name))
ValueError: fft() requires a code object with 3 free vars, not 0
]
[autoreload of numpy.ma.core failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 410, in superreload
    update_generic(old_obj, new_obj)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 347, in update_generic
    update(a, b)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 317, in update_class
    update_instances(old, new)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 280, in update_instances
    ref.__class__ = new
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\ma\core.py", line 6443, in __setattr__
    return super(MaskedConstant, self).__setattr__(attr, value)
TypeError: super(type, obj): obj must be an instance or subtype of type
]
[autoreload of numpy failed: Traceback (most recent call last):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 245, in check
    superreload(m, reload, self.old_objects)
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\IPython\extensions\autoreload.py", line 394, in superreload
    module = reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\imp.py", line 314, in reload
    return importlib.reload(module)
  File "C:\Users\user\.conda\envs\datalab\lib\importlib\__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\__init__.py", line 170, in <module>
    core.getlimits._register_known_types()
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\getlimits.py", line 162, in _register_known_types
    with numeric.errstate(all='ignore'):
  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\_ufunc_config.py", line 432, in __enter__
ValueError: Only callable can be used as callback
]
Traceback (most recent call last):

  File "C:\Users\user\AppData\Local\Temp/ipykernel_7080/431417879.py", line 2, in <module>
    from sklearn.linear_model import RidgeClassifierCV

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\sklearn\__init__.py", line 82, in <module>
    from .base import clone

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\sklearn\base.py", line 17, in <module>
    from .utils import _IS_32BIT

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\sklearn\utils\__init__.py", line 28, in <module>
    from .fixes import np_version, parse_version

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\sklearn\utils\fixes.py", line 20, in <module>
    import scipy.stats

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\scipy\stats\__init__.py", line 441, in <module>
    from .stats import *

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\scipy\stats\stats.py", line 37, in <module>
    from scipy.spatial.distance import cdist

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\scipy\spatial\__init__.py", line 101, in <module>
    from ._procrustes import procrustes

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\scipy\spatial\_procrustes.py", line 9, in <module>
    from scipy.linalg import orthogonal_procrustes

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\scipy\linalg\__init__.py", line 204, in <module>
    from .decomp_schur import *

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\scipy\linalg\decomp_schur.py", line 178, in <module>
    eps = numpy.finfo(float).eps

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\getlimits.py", line 485, in __new__

  File "C:\Users\user\.conda\envs\datalab\lib\site-packages\numpy\core\getlimits.py", line 499, in _init
    self.dtype = numeric.dtype(int_type)

AttributeError: 'MachArLike' object has no attribute 'smallest_subnormal'

CodePudding user response:

I was able to bruteforce my way through the versions. Here is what works for me: numpy==1.21.0 numba==0.55.1 scikit-learn==1.0.2 scipy==1.7.3 sklearn==0.0 sktime==0.10.1 –

  • Related