Closed JosephKarpinski closed 5 months ago
For what it's worth, according to the commit log, Theano has not been actively maintained since 2020, seeing only sporadic commits since then. I don't think we should roll back numpy API changes to keep unmaintained libraries working without any need for downstream updates.
Are there other libraries besides theano that you're seeing issues from?
It also looks like the theano fork, pytensor, is getting some attention for numpy 2.0 support: https://github.com/pymc-devs/pytensor/issues/688
Well, I guess I don’t understand the reasoning for the bumpy aliases removals given so many Python packages have been using them for some time. If a package hasn’t been updated like that mentioned above, the code no longer works. Yes, many have done the updates but others haven’t, since the author is now working on other things. Adding the alias again, allows existing packages to work under current versions of Python.
From: Nathan Goldbaum @.> Sent: Tuesday, April 23, 2024 10:17 AM To: numpy/numpy @.> Cc: JosephKarpinski @.>; Author @.> Subject: Re: [numpy/numpy] BUG: Restore numpy alias such as np.bool, np.int etc (Issue #26333)
For what it's worth, according to the commit log, Theano has not been actively maintained since 2020, seeing only sporadic commits since then. I don't think we should roll back numpy API changes to keep unmaintained libraries working without any need for downstream updates.
Are there other libraries besides theano that you're seeing issues from?
— Reply to this email directly, view it on GitHubhttps://github.com/numpy/numpy/issues/26333#issuecomment-2072437939, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3HMIA6KAQORLXHNIG6VUTY6ZUQZAVCNFSM6AAAAABGT4AUCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZSGQZTOOJTHE. You are receiving this because you authored the thread.Message ID: @.***>
For more rationale, see the NEP describing this work: https://numpy.org/neps/nep-0052-python-api-cleanup.html
I'll also note that np.bool
has been deprecated since numpy 1.20, released Jan 2021, and accessing the attribute produced a warning that it would be removed in the future.
It's true that this change broke code like theano that hasn't seen updates for the past few years.
That said, there were probably also other changes in numpy that would lead to other breakage besides this, this is just the most visible change for your usage. There might also be other changes in numpy 2.0 that would break theano, particularly changes to the numpy C API. Judging from the issue I linked earlier, it seems the pytensor
folks are trying to fix changes related to our wrappers for the C complex types.
Just to clarify the timelines because I confused myself a little and got things a little wrong linking to NEP 52 above, the removal of np.bool
predates numpy 2.0. As the error message says, it was originally an alias for the bool
builtin, but people were using it as if it was an alias for the numpy boolean scalar.
In numpy 1.20, we deprecated it, and then removed it in numpy 1.24.
In numpy 2.0, we actually re-added it, but as the an alias for the numpy boolean scalar type.
Anyway, for bool in particular, this is all kind of old news. There were other API changes for numpy 2.0 and the NEP discusses the rationale there.
Well, I was transitioning between Python 3.11.4 and Python[arm64] 3.11.8 and was running into numerous np.bool packages. Python 3.11.8 issues appear to be less. I’ll create package issues for those I find with each package author. Let’s close this issue for now. I’m guessing others will run into similar alias issues when they add packages that require updated versions of NumPy. My thought was, restoring the NumPy alias would address that issue for many Python users.
From: Nathan Goldbaum @.> Sent: Tuesday, April 23, 2024 9:20 PM To: numpy/numpy @.> Cc: JosephKarpinski @.>; Author @.> Subject: Re: [numpy/numpy] BUG: Restore numpy alias such as np.bool, np.int etc (Issue #26333)
Just to clarify the timelines because I confused myself a little and got things a little wrong linking to NEP 52 above, the removal of np.bool predates numpy 2.0. As the error message says, it was originally an alias for the bool builtin, but people were using it as if it was an alias for the numpy boolean scalar.
In numpy 1.20, we deprecated it, and then removed it in numpy 1.24.
In numpy 2.0, we actually re-added it, but as the an alias for the numpy boolean scalar type.
Anyway, for bool in particular, this is all kind of old news. There were other API changes for numpy 2.0 and the NEP discusses the rationale there.
— Reply to this email directly, view it on GitHubhttps://github.com/numpy/numpy/issues/26333#issuecomment-2073799462, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI3HMIE7FZFFYLDFEHESYUDY64CEPAVCNFSM6AAAAABGT4AUCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZTG44TSNBWGI. You are receiving this because you authored the thread.Message ID: @.***>
Describe the issue:
There are so many Python packages that haven't replaced np.bool, np.int, etc. So many useless errors with no work around, except the developer making the changes. Installing an older version of numpy breaks all types of dependencies. Adding the aliases back to numpy fixes so many issues.
Reproduce the code example:
Error message:
Python and NumPy Versions:
import sys, numpy print(numpy.version) print(sys.version)
1.26.4 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:49:36) [Clang 16.0.6 ]
Runtime Environment:
[{'numpy_version': '1.26.4', 'python': '3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:49:36) ' '[Clang 16.0.6 ]', 'uname': uname_result(system='Darwin', node='Josephs-iMac-2.local', release='23.2.0', version='Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103', machine='arm64')}, {'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'], 'found': ['ASIMDHP'], 'notfound': ['ASIMDFHM']}}, {'architecture': 'armv8', 'filepath': '/opt/anaconda3/envs/envM1arm64/lib/python3.11/site-packages/numpy/.dylibs/libopenblas64.0.dylib', 'internal_api': 'openblas', 'num_threads': 8, 'prefix': 'libopenblas', 'threading_layer': 'pthreads', 'user_api': 'blas', 'version': '0.3.23.dev'}, {'architecture': 'neoversen1', 'filepath': '/opt/anaconda3/envs/envM1arm64/lib/python3.11/site-packages/scipy/.dylibs/libopenblas.0.dylib', 'internal_api': 'openblas', 'num_threads': 8, 'prefix': 'libopenblas', 'threading_layer': 'pthreads', 'user_api': 'blas', 'version': '0.3.26.dev'}, {'filepath': '/opt/anaconda3/envs/envM1arm64/lib/python3.11/site-packages/sklearn/.dylibs/libomp.dylib', 'internal_api': 'openmp', 'num_threads': 8, 'prefix': 'libomp', 'user_api': 'openmp', 'version': None}] None
Context for the issue:
there are so many packages that haven't replaced np.boole even under the latest arm64 environment from Anaconda:
Anaconda3-2024.02-1-MacOSX-arm64.pkg