Skip to content

Commit e6a7657

Browse files
committed
DOC: Add intructions to build NumPy on WoA
1 parent dc78e30 commit e6a7657

File tree

1 file changed

+72
-2
lines changed

1 file changed

+72
-2
lines changed

doc/source/building/index.rst

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,60 @@ your system.
220220
try again. The Fortran compiler should be installed as described in
221221
this section.
222222

223+
.. tab-item:: Windows on ARM64
224+
:sync: Windows on ARM64
225+
226+
In Windows on ARM64, the set of a compiler options that are available for
227+
building NumPy are limited. Compilers such as GCC and GFortran are not yet
228+
supported for Windows on ARM64. Currently, the NumPy build for Windows on ARM64
229+
is supported with MSVC toolchain only. The use of a Fortran compiler is more
230+
tricky than on other platforms, because MSVC does not support Fortran, and
231+
gfortran and MSVC can't be used together. If you don't need to run the ``f2py``
232+
tests, simply using MSVC is easiest. Otherwise, you will need the following
233+
set of compilers:
234+
235+
1. MSVC + Flang-new (``flang-new``)
236+
237+
First, install Microsoft Visual Studio - the 2022 Community Edition will
238+
work(see the `Visual Studio download site <https://visualstudio.microsoft.com/downloads/>`__).
239+
In order to ensure you have the Windows Universal C Runtime (the other components
240+
of Visual Studio can be deselected if desired, to save disk space). The
241+
recommended version of the UCRT is >= 10.0.22621.0.
242+
243+
To use flang-new fortran compiler for Windows on ARM64, install Latest LLVM
244+
toolchain for WoA from `here <https://github.com/llvm/llvm-project/releases>`__.
245+
246+
.. tab-set::
247+
248+
.. tab-item:: MSVC
249+
250+
The MSVC installer does not put the compilers on the system path, and
251+
the install location may change. To query the install location, MSVC
252+
comes with a ``vswhere.exe`` command-line utility. And to make the
253+
C/C++ compilers available inside the shell you are using, you need to
254+
run a ``.bat`` file for the correct bitness and architecture (e.g., for
255+
ARM64-based CPUs, use ``vcvarsarm64.bat``).
256+
257+
For detailed guidance, see `Use the Microsoft C++ toolset from the command line
258+
<https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170>`__.
259+
260+
.. note::
261+
262+
Compilers should be on the system path (i.e., the ``PATH`` environment
263+
variable should contain the directory in which the compiler executables
264+
can be found) in order to be found, with the exception of MSVC which
265+
will be found automatically if and only if there are no other compilers
266+
on the ``PATH``. You can use any shell (e.g., Powershell, ``cmd`` or
267+
Git Bash) to invoke a build. To check that this is the case, try
268+
invoking a Fortran compiler in the shell you use (e.g., ``flang-new
269+
--version``).
270+
271+
.. warning::
272+
273+
Currently, Conda environment is not yet supported officially on `Windows
274+
on ARM64 <https://github.com/conda-forge/conda-forge.github.io/issues/1940>`__.
275+
The present approach uses virtualenv for building NumPy from source on
276+
Windows on ARM64.
223277

224278
Building NumPy from source
225279
--------------------------
@@ -302,7 +356,7 @@ Then you want to do the following:
302356
1. Create a dedicated development environment (virtual environment or conda
303357
environment),
304358
2. Install all needed dependencies (*build*, and also *test*, *doc* and
305-
*optional* dependencies),
359+
*optional* dependencies),
306360
3. Build NumPy with the ``spin`` developer interface.
307361

308362
Step (3) is always the same, steps (1) and (2) are different between conda and
@@ -361,9 +415,25 @@ virtual environments:
361415
python -m venv venv
362416
.\venv\Scripts\activate
363417

418+
.. tab-item:: Windows on ARM64
419+
:sync: Windows on ARM64
420+
421+
::
422+
423+
python -m venv venv
424+
.\venv\Scripts\activate
425+
426+
.. note::
427+
428+
Building NumPy with BLAS and LAPACK functions requires OpenBLAS
429+
library at Runtime. In Windows on ARM64, this can be done by setting
430+
up pkg-config for OpenBLAS dependency. The build steps for OpenBLAS
431+
for Windows on ARM64 can be found `here <https://github.com/OpenMathLib/OpenBLAS/blob/develop/docs/install.md#windows-on-arm>`__.
432+
433+
364434
Then install the Python-level dependencies from PyPI with::
365435

366-
python -m pip install -r requirements/all_requirements.txt
436+
python -m pip install -r requirements/build_requirements.txt
367437

368438
To build NumPy in an activated development environment, run::
369439

0 commit comments

Comments
 (0)