indygreg / python-build-standalone

Produce redistributable builds of Python
BSD 3-Clause "New" or "Revised" License
1.71k stars 107 forks source link

numpy does not work with msvc-static-install-only artefact #124

Closed jheaff1 closed 2 years ago

jheaff1 commented 2 years ago

Steps to reproduce:

  1. Download the latest msvc-static-install-only release
  2. Extract the tarball
  3. Run python.exe -m pip install numpy
  4. Run python.exe -c "import numpy" and the following error is printed
Console output ``` Traceback (most recent call last): File "C:\msys64\home\jheaff1\temp\temp\python\lib\site-packages\numpy\core\__init__.py", line 23, in from . import multiarray File "C:\msys64\home\jheaff1\temp\temp\python\lib\site-packages\numpy\core\multiarray.py", line 10, in from . import overrides File "C:\msys64\home\jheaff1\temp\temp\python\lib\site-packages\numpy\core\overrides.py", line 6, in from numpy.core._multiarray_umath import ( ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "C:\msys64\home\jheaff1\temp\temp\python\lib\site-packages\numpy\__init__.py", line 144, in from . import core File "C:\msys64\home\jheaff1\temp\temp\python\lib\site-packages\numpy\core\__init__.py", line 49, in raise ImportError(msg) ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.10 from "C:\msys64\home\jheaff1\temp\temp\python\python.exe" * The NumPy version is: "1.22.3" and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help. Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found. ```

This issue does not occur with the msvc-shared-install-only artefact

indygreg commented 2 years ago

I'm going to say won't fix on this because the Windows static distributions are extremely brittle: https://python-build-standalone.readthedocs.io/en/latest/quirks.html#windows-static-distributions-are-extremely-brittle.

They sound like a good idea. But in reality nearly every non-trivial Python C extensions I've seen doesn't work with them unless they are recompiled from source. And even then, there are problems. Numpy's build process on Windows is especially thorny and I would expect it to fall in the camp of extensions that wouldn't work with our static builds without invasive changes to its build system.

I recommend most users steer clear of the Windows static distributions. Perhaps I should make this warning more visible in the docs linked earlier?

jheaff1 commented 2 years ago

Many thanks for the explanation. I think the existing docs are sufficient 😁