Closed caspar-iqm closed 1 year ago
Hi Caspar,
thank you for opening this issue. Unfortunately I haven't been able to reproduce this issue with numpy 1.23.5
, which is the most recent version available via Anaconda.
Could you maybe specify the version of numpy
you are using and maybe also provide a minimal working example, so that I can reproduce the issue?
Best, Philipp
Hi Philipp,
I checked the versions now, indeed this appears only as an error with numpy 1.24 (in particular I tested 1.24.1 and 1.24.2). In numpy 1.23.5 it does trigger a warning, you can test on that version by forcing warnings to be treated as errors:
import warnings
warnings.filterwarnings("error")
I also noticed the full error message has quite clear instructions, np.complex
should just be replaced with complex
to preserve the same behavior.
AttributeError: module 'numpy' has no attribute 'complex'.
np.complex
was a deprecated alias for the builtincomplex
. To avoid this error in existing code, usecomplex
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, usenp.complex128
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
Hi,
thanks for coming back to this. I have changed np.complex
to complex
.
It should now be resolved with the latest commit. Can you confirm this?
Hi Philipp,
I tested it now (finally), it works as it should. Thanks!
Hi Philipp!
I noticed CirquitQ breaks with the most recent numpy due to the
np.complex
attribute being deprecated. From what I understandnp.complex128
is available to explicitly specify the datatype.Relevant part of the traceback: