Cannot import glumpy with numpy >= 1.24 - np.bool removed from numpy · Issue #309 · glumpy/glumpy · GitHub
Skip to content

Cannot import glumpy with numpy >= 1.24 - np.bool removed from numpy #309

Description

@fjansson

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 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions