I installed Jupyter Notebook on my new computer. When I am trying to import python libraries, some raise no errors, and others (known libraries that I have worked with before) raise a recursion error with the following message:
RecursionError Traceback (most recent call last)
Cell In[2], line 3
1 import pandas as pd
2 import numpy as np
----> 3 import ruptures
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/ruptures/__init__.py:4
1 """Offline change point detection for Python."""
3 from .datasets import pw_constant, pw_linear, pw_normal, pw_wavy
----> 4 from .detection import Binseg, BottomUp, Dynp, KernelCPD, Pelt, Window
5 from .exceptions import NotEnoughPoints
6 from .show import display
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/ruptures/detection/__init__.py:3
1 r"""Search methods."""
----> 3 from .binseg import Binseg
4 from .bottomup import BottomUp
5 from .dynp import Dynp
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/ruptures/detection/binseg.py:6
4 import numpy as np
5 from ruptures.base import BaseCost, BaseEstimator
----> 6 from ruptures.costs import cost_factory
7 from ruptures.exceptions import BadSegmentationParameters
8 from ruptures.utils import pairwise, sanity_check
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/ruptures/costs/__init__.py:11
9 from .costautoregressive import CostAR
10 from .costml import CostMl
---> 11 from .costrank import CostRank
12 from .costcosine import CostCosine
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/ruptures/costs/costrank.py:4
2 import numpy as np
3 from numpy.linalg import pinv, LinAlgError
----> 4 from scipy.stats.mstats import rankdata
6 from ruptures.base import BaseCost
7 from ruptures.costs import NotEnoughPoints
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/scipy/stats/__init__.py:610
1 """
2 .. _statsrefmanual:
3
(...)
605
606 """ # noqa: E501
608 from ._warnings_errors import (ConstantInputWarning, NearConstantInputWarning,
609 DegenerateDataWarning, FitError)
--> 610 from ._stats_py import *
611 from ._variation import variation
612 from .distributions import *
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/scipy/stats/_stats_py.py:49
46 # Import unused here but needs to stay until end of deprecation periode
47 # See https://github.com/scipy/scipy/issues/15765#issuecomment-1875564522
48 from scipy import linalg # noqa: F401
---> 49 from . import distributions
50 from . import _mstats_basic as mstats_basic
52 from ._stats_mstats_common import _find_repeats, theilslopes, siegelslopes
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/scipy/stats/distributions.py:10
1 #
2 # Author: Travis Oliphant 2002-2011 with contributions from
3 # SciPy Developers 2004-2011
(...)
6 # instead of `git blame -Lxxx,+x`.
7 #
8 from ._distn_infrastructure import (rv_discrete, rv_continuous, rv_frozen) # noqa: F401
---> 10 from . import _continuous_distns
11 from . import _discrete_distns
13 from ._continuous_distns import * # noqa: F403
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/scipy/stats/_continuous_distns.py:12
10 import numpy as np
11 from numpy.polynomial import Polynomial
---> 12 from scipy.interpolate import BSpline
13 from scipy._lib.doccer import (extend_notes_in_docstring,
14 replace_notes_in_docstring,
15 inherit_docstring_from)
16 from scipy._lib._ccallback import LowLevelCallable
File /opt/anaconda3/envs/reg_env/lib/python3.11/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 /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/scipy/interpolate/_interpolate.py:12
9 from scipy._lib._util import copy_if_needed
10 from scipy.special import comb
---> 12 from . import _fitpack_py
13 from ._polyint import _Interpolator1D
14 from . import _ppoly
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/scipy/interpolate/_fitpack_py.py:8
5 import numpy as np
7 # These are in the API for fitpack even if not used in fitpack.py itself.
----> 8 from ._fitpack_impl import bisplrep, bisplev, dblint # noqa: F401
9 from . import _fitpack_impl as _impl
10 from ._bsplines import BSpline
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/scipy/interpolate/_fitpack_impl.py:103
52 _iermess = {
53 0: ["The spline has a residual sum of squares fp such that "
54 "abs(fp-s)/s<=0.001", None],
(...)
68 'unknown': ["An error occurred", TypeError]
69 }
71 _iermess2 = {
72 0: ["The spline has a residual sum of squares fp such that "
73 "abs(fp-s)/s<=0.001", None],
(...)
99 'unknown': ["An error occurred", TypeError]
100 }
102 _parcur_cache = {'t': array([], float), 'wrk': array([], float),
--> 103 'iwrk': array([], dfitpack_int), 'u': array([], float),
104 'ub': 0, 'ue': 1}
107 def splprep(x, w=None, u=None, ub=None, ue=None, k=3, task=0, s=None, t=None,
108 full_output=0, nest=None, per=0, quiet=1):
109 # see the docstring of `_fitpack_py/splprep`
110 if task <= 0:
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:46, in __repr__(dtype)
45 def __repr__(dtype):
---> 46 arg_str = _construction_repr(dtype, include_align=False)
47 if dtype.isalignedstruct:
48 arg_str = arg_str + ", align=True"
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:100, in _construction_repr(dtype, include_align, short)
98 return _subarray_str(dtype)
99 else:
--> 100 return _scalar_str(dtype, short=short)
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:143, in _scalar_str(dtype, short)
140 elif dtype.type == np.timedelta64:
141 return "'%sm8%s'" % (byteorder, _datetime_metadata_str(dtype))
--> 143 elif np.issubdtype(dtype, np.number):
144 # Short repr with endianness, like '<f8'
145 if short or dtype.byteorder not in ('=', '|'):
146 return "'%s%c%d'" % (byteorder, dtype.kind, dtype.itemsize)
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/numerictypes.py:417, in issubdtype(arg1, arg2)
359 r"""
360 Returns True if first argument is a typecode lower/equal in type hierarchy.
361
(...)
414
415 """
416 if not issubclass_(arg1, generic):
--> 417 arg1 = dtype(arg1).type
418 if not issubclass_(arg2, generic):
419 arg2 = dtype(arg2).type
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:46, in __repr__(dtype)
45 def __repr__(dtype):
---> 46 arg_str = _construction_repr(dtype, include_align=False)
47 if dtype.isalignedstruct:
48 arg_str = arg_str + ", align=True"
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:100, in _construction_repr(dtype, include_align, short)
98 return _subarray_str(dtype)
99 else:
--> 100 return _scalar_str(dtype, short=short)
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:143, in _scalar_str(dtype, short)
140 elif dtype.type == np.timedelta64:
141 return "'%sm8%s'" % (byteorder, _datetime_metadata_str(dtype))
--> 143 elif np.issubdtype(dtype, np.number):
144 # Short repr with endianness, like '<f8'
145 if short or dtype.byteorder not in ('=', '|'):
146 return "'%s%c%d'" % (byteorder, dtype.kind, dtype.itemsize)
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/numerictypes.py:417, in issubdtype(arg1, arg2)
359 r"""
360 Returns True if first argument is a typecode lower/equal in type hierarchy.
361
(...)
414
415 """
416 if not issubclass_(arg1, generic):
--> 417 arg1 = dtype(arg1).type
418 if not issubclass_(arg2, generic):
419 arg2 = dtype(arg2).type
[... skipping similar frames: __repr__ at line 46 (475 times), _construction_repr at line 100 (475 times), _scalar_str at line 143 (475 times), issubdtype at line 417 (475 times)]
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:46, in __repr__(dtype)
45 def __repr__(dtype):
---> 46 arg_str = _construction_repr(dtype, include_align=False)
47 if dtype.isalignedstruct:
48 arg_str = arg_str + ", align=True"
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:100, in _construction_repr(dtype, include_align, short)
98 return _subarray_str(dtype)
99 else:
--> 100 return _scalar_str(dtype, short=short)
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/_dtype.py:143, in _scalar_str(dtype, short)
140 elif dtype.type == np.timedelta64:
141 return "'%sm8%s'" % (byteorder, _datetime_metadata_str(dtype))
--> 143 elif np.issubdtype(dtype, np.number):
144 # Short repr with endianness, like '<f8'
145 if short or dtype.byteorder not in ('=', '|'):
146 return "'%s%c%d'" % (byteorder, dtype.kind, dtype.itemsize)
File /opt/anaconda3/envs/reg_env/lib/python3.11/site-packages/numpy/core/numerictypes.py:417, in issubdtype(arg1, arg2)
359 r"""
360 Returns True if first argument is a typecode lower/equal in type hierarchy.
361
(...)
414
415 """
416 if not issubclass_(arg1, generic):
--> 417 arg1 = dtype(arg1).type
418 if not issubclass_(arg2, generic):
419 arg2 = dtype(arg2).type
RecursionError: maximum recursion depth exceeded while getting the repr of an object
This happens with other libraries as well.
Any suggestions?
Thanks!
Iv’e tried the solution of:
import sys
sys.setrecursionlimit(3000)
but it did not help.