'something wrong about scipy and numpy, when i import scipy.stats.linregress

when i import scipy.stats.linregress, to do something about ols, there is a typeerror.

when i run my code in pycharm, all is ok. there is no error and i can get the right results.

but when i debug my code, i got a typeerror.

Python 3.10.1 amd64

numpy 1.22.0 amd64

scipy 1.7.3 amd64

my code like this:

from scipy import stats
results = stats.linregress(low.loc[ind], high.loc[ind])

and the error info like this:

Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\numpy\core\getlimits.py", line 516, in __init__
    self.dtype = numeric.dtype(int_type)
TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\workspace\python\tuvn\my_funcs\__init__.py", line 39, in <module>
    from my_funcs.get_rsrs import get_rsrs
  File "D:\workspace\python\tuvn\my_funcs\get_rsrs.py", line 2, in <module>
    from scipy import stats
  File "C:\Program Files\Python310\lib\site-packages\scipy\stats\__init__.py", line 441, in <module>
    from .stats import *
  File "C:\Program Files\Python310\lib\site-packages\scipy\stats\stats.py", line 37, in <module>
    from scipy.spatial.distance import cdist
  File "C:\Program Files\Python310\lib\site-packages\scipy\spatial\__init__.py", line 101, in <module>
    from ._procrustes import procrustes
  File "C:\Program Files\Python310\lib\site-packages\scipy\spatial\_procrustes.py", line 9, in <module>
    from scipy.linalg import orthogonal_procrustes
  File "C:\Program Files\Python310\lib\site-packages\scipy\linalg\__init__.py", line 195, in <module>
    from .misc import *
  File "C:\Program Files\Python310\lib\site-packages\scipy\linalg\misc.py", line 4, in <module>
    from .lapack import get_lapack_funcs
  File "C:\Program Files\Python310\lib\site-packages\scipy\linalg\lapack.py", line 990, in <module>
    _int32_max = _np.iinfo(_np.int32).max
  File "C:\Program Files\Python310\lib\site-packages\numpy\core\getlimits.py", line 518, in __init__
    self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source