glumpy
glumpy copied to clipboard
Cannot import glumpy with numpy >= 1.24 - np.bool removed from numpy
import glumpy
gives
/home/fjansson/.local/lib/python3.10/site-packages/glumpy/gloo/variable.py:82: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar. (This may have returned Python scalars in past versions.
gl.GL_BOOL : ( 1, gl.GL_BOOL, np.bool),
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/fjansson/.local/lib/python3.10/site-packages/glumpy/__init__.py", line 7, in <module>
from . import app
File "/home/fjansson/.local/lib/python3.10/site-packages/glumpy/app/__init__.py", line 23, in <module>
from . console import Console
File "/home/fjansson/.local/lib/python3.10/site-packages/glumpy/app/console.py", line 7, in <module>
from glumpy import gl, glm, gloo
File "/home/fjansson/.local/lib/python3.10/site-packages/glumpy/gloo/__init__.py", line 7, in <module>
from . program import Program
File "/home/fjansson/.local/lib/python3.10/site-packages/glumpy/gloo/program.py", line 16, in <module>
from . variable import gl_typeinfo, Uniform, Attribute
File "/home/fjansson/.local/lib/python3.10/site-packages/glumpy/gloo/variable.py", line 82, in <module>
gl.GL_BOOL : ( 1, gl.GL_BOOL, np.bool),
File "/usr/lib/python3.10/site-packages/numpy/__init__.py", line 284, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool'. Did you mean: 'bool_'?
I have numpy 1.24.1 and glumpy 1.2.0, Python 3.10.9.
The reason is probably that numpy removed np.bool and other such type aliases in release 1.24.0, they have been deprecated for some time, see https://github.com/numpy/numpy/releases/tag/v1.24.0 . The file glumpy/gloo/variable.py uses many such aliases.
Here is documentation of the deprecations and what to replace the types with: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations .
A fix has been proposed and I just merged it. Can you try?
I installed the latest commit using pip, and it works. Thank you!
pip install -U git+https://github.com/glumpy/glumpy@54a7eab7c08fb
The only slight weirdness I found is the version numbering: pip said Successfully installed glumpy-1.1.1
and
glumpy.__version__
returns 1.0.6
.
Oh, I need to bump the internal version number. Do you want to make a PR?
I don't think I'd do a very useful job with the version - I don't know where the version number is set, and also not what to set it to... perhaps just bump it for the next release?
I've found the line.