# Error: ‘PyArray\_Descr’ has no member named ‘elsize’

**URL:** <https://discuss.pytorch.org/t/error-pyarray-descr-has-no-member-named-elsize/213726>\
**Category:** Uncategorized\
**Created:** [December 3, 2024, 4:22am UTC](https://discuss.pytorch.org/t/error-pyarray-descr-has-no-member-named-elsize/213726 "2024-12-03T04:22:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuler](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/tuler/32/74315_2.png) [@tuler](https://discuss.pytorch.org/u/tuler)\
**Post date:** [December 3, 2024, 4:22am UTC](https://discuss.pytorch.org/t/error-pyarray-descr-has-no-member-named-elsize/213726/1 "2024-12-03T04:22:38Z")

</div>

I’m trying to compile a specific version of PyTorch (2.1.2) from source in Linux, but I’m facing the following issue:

```auto
[1861/1881] Building CXX object caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_numpy.cpp.o
  FAILED: caffe2/torch/CMakeFiles/torch_python.dir/csrc/utils/tensor_numpy.cpp.o
  /src/pytorch/torch/csrc/utils/tensor_numpy.cpp: In function ‘at::Tensor torch::utils::tensor_from_cuda_array_interface(PyObject*)’:
  /src/pytorch/torch/csrc/utils/tensor_numpy.cpp:404:34: error: ‘PyArray_Descr’ has no member named ‘elsize’
    404 | dtype_size_in_bytes = descr->elsize;
        | ^ ~~~~~

```

Maybe the cause is an incompatible version of NumPy that is being pulled in.

ps: my environment is actually a bit different. It’s a slightly patched PyTorch being built on riscv64 using qemu. But maybe the error is not related.

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [December 3, 2024, 8:37pm UTC](https://discuss.pytorch.org/t/error-pyarray-descr-has-no-member-named-elsize/213726/2 "2024-12-03T20:37:22Z")

</div>

Downgrade `numpy` to `<2.0` and try to rebuild PyTorch.

---

<div class="post-metadata">

**Author:** ![tuler](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/tuler/32/74315_2.png) [@tuler](https://discuss.pytorch.org/u/tuler)\
**Post date:** [December 5, 2024, 3:39pm UTC](https://discuss.pytorch.org/t/error-pyarray-descr-has-no-member-named-elsize/213726/3 "2024-12-05T15:39:22Z")

</div>

That worked. Thanks for the tip.
