Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.11 + numpy>=2 not working #927

Open
ptrampert opened this issue Nov 28, 2024 · 0 comments
Open

python3.11 + numpy>=2 not working #927

ptrampert opened this issue Nov 28, 2024 · 0 comments

Comments

@ptrampert
Copy link

When installing tsai with the provided pip install tsai[extras] option using Python3.11 numpy 2.0.2 is installed. Downgrading numpy is not possible with 3.11.

Unfortunately, this is not compatible with the current tsai 0.3.9 package. Just trying to import from tsai import * delivers

AttributeError Traceback (most recent call last)
Cell In[1], line 2
1 #|export
----> 2 from tsai.imports import *
3 from matplotlib.backends.backend_agg import FigureCanvasAgg
4 from pyts.image.gaf import GramianAngularField

File ~/.local/lib/python3.11/site-packages/tsai/imports.py:49
47 import pandas as pd
48 import psutil
---> 49 import sklearn.metrics as skm
50 import torch
51 import torch.nn as nn

File ~/.local/lib/python3.11/site-packages/sklearn/init.py:84
70 # We are not importing the rest of scikit-learn during the build
71 # process, as it may not be compiled yet
72 else:
(...)
78 # later is linked to the OpenMP runtime to make it possible to introspect
79 # it and importing it first would fail if the OpenMP dll cannot be found.
80 from . import (
81 __check_build, # noqa: F401
82 _distributor_init, # noqa: F401
83 )
---> 84 from .base import clone
85 from .utils._show_versions import show_versions
87 all = [
88 "calibration",
89 "cluster",
(...)
130 "show_versions",
131 ]

File ~/.local/lib/python3.11/site-packages/sklearn/base.py:19
17 from ._config import config_context, get_config
18 from .exceptions import InconsistentVersionWarning
---> 19 from .utils._estimator_html_repr import _HTMLDocumentationLinkMixin, estimator_html_repr
20 from .utils._metadata_requests import _MetadataRequester, _routing_enabled
21 from .utils._param_validation import validate_parameter_constraints

File ~/.local/lib/python3.11/site-packages/sklearn/utils/init.py:11
9 from . import _joblib, metadata_routing
10 from ._bunch import Bunch
---> 11 from ._chunking import gen_batches, gen_even_slices
12 from ._estimator_html_repr import estimator_html_repr
14 # Make _safe_indexing importable from here for backward compat as this particular
15 # helper is considered semi-private and typically very useful for third-party
16 # libraries that want to comply with scikit-learn's estimator API. In particular,
17 # _safe_indexing was included in our public API documentation despite the leading
18 # _ in its name.

File ~/.local/lib/python3.11/site-packages/sklearn/utils/_chunking.py:8
5 import numpy as np
7 from .._config import get_config
----> 8 from ._param_validation import Interval, validate_params
11 def chunk_generator(gen, chunksize):
12 """Chunk generator, gen into lists of length chunksize. The last
13 chunk may have a length less than chunksize."""

File ~/.local/lib/python3.11/site-packages/sklearn/utils/_param_validation.py:14
11 from scipy.sparse import csr_matrix, issparse
13 from .._config import config_context, get_config
---> 14 from .validation import _is_arraylike_not_scalar
17 class InvalidParameterError(ValueError, TypeError):
18 """Custom exception to be raised when the parameter of a class/method/function
19 does not have a valid type or value.
20 """

File ~/.local/lib/python3.11/site-packages/sklearn/utils/validation.py:26
24 from .. import get_config as _get_config
25 from ..exceptions import DataConversionWarning, NotFittedError, PositiveSpectrumWarning
---> 26 from ..utils._array_api import _asarray_with_order, _is_numpy_namespace, get_namespace
27 from ..utils.fixes import ComplexWarning, _preserve_dia_indices_dtype
28 from ._isfinite import FiniteStatus, cy_isfinite

File ~/.local/lib/python3.11/site-packages/sklearn/utils/_array_api.py:11
8 import scipy.special as special
10 from .._config import get_config
---> 11 from .fixes import parse_version
13 _NUMPY_NAMESPACE_NAMES = {"numpy", "array_api_compat.numpy"}
16 def yield_namespaces(include_numpy_namespaces=True):

File ~/.local/lib/python3.11/site-packages/sklearn/utils/fixes.py:21
19 import scipy
20 import scipy.sparse.linalg
---> 21 import scipy.stats
23 try:
24 import pandas as pd

File ~/.local/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 ~/.local/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 scipy/scipy#15765 (comment)
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 ~/.local/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 ~/.local/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 ~/.local/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 ~/.local/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 ~/.local/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 ~/.local/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 ~/.local/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 ~/.local/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 ~/.local/lib/python3.11/site-packages/numpy/_core/_dtype.py:106, in _scalar_str(dtype, short)
103 def _scalar_str(dtype, short):
104 byteorder = _byte_order_str(dtype)
--> 106 if dtype.type == np.bool:
107 if short:
108 return "'?'"

File ~/.local/lib/python3.11/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 'bool'.
np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant