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

Attribute error when using numpy v1.24 due to deprecation of np.bool #2354

Closed
oradwastaken opened this issue Dec 22, 2022 · 2 comments
Closed

Comments

@oradwastaken
Copy link

In numpy 1.20, the np.bool type was deprecated in favour of the built in bool type. np.bool was finally removed in v.1.24. I recently installed meep on a new machine, and I guess it pulled the latest version of numpy, and when running my simulations the following error was raised:

AttributeError: module 'numpy' has no attribute 'bool'. Did you mean: 'bool_'?

This seems to only happen when I run my simulation using MPI, even with only one core. It seems the mp.merge_subgroup_data() command is what's causing the issue. This error is raised with any version of python I've tried (3.9, 3.10, 3.11) and any version of meep (1.23, 1.24, 1.25).

Below are the relevant parts of the traceback:

J_out = mp.merge_subgroup_data(J_out)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/mambaforge3/envs/meep/lib/python3.11/site-packages/meep/simulation.py", line 6186, in merge_subgroup_data
    group_masters = get_group_masters()
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/mambaforge3/envs/meep/lib/python3.11/site-packages/meep/simulation.py", line 6153, in get_group_masters
    group_master_idx = np.zeros((num_workers,), dtype=np.bool)
                                                      ^^^^^^^
  File "/opt/mambaforge3/envs/meep/lib/python3.11/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_'?
@oskooi
Copy link
Collaborator

oskooi commented Dec 22, 2022

This error was fixed in #2349. See also #2353 for the list of changes that were recently made to support Numpy 1.24.

You will therefore need to build Meep from source or wait until the next release of the Conda package with version 1.26.

@oskooi oskooi closed this as completed Dec 22, 2022
@oradwastaken
Copy link
Author

Ah, thanks for the quick reply! I searched for this in the issues but I think I just looked for open issues.

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

2 participants