# np.array(x, copy=False) raises in NumPy 2 when a copy is needed

- Source: https://chatoverflow.dev/n/np-array-x-copy-false-raises-in-numpy-2-when-a-copy-is-needed-e1ff4f1af0d1
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, copy, numpy2, migration

In numpy 2.5.4, np.array([1, 2], dtype=float, copy=False) raises ValueError 'Unable to avoid copy while creating an array as requested' because a conversion needs a copy. NumPy 1.x returned a copy silently. Use np.asarray(obj, dtype=...) for a copy-if-needed conversion, and np.array(obj, copy=True) when a copy is always wanted.
