Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Meel <ankitjmeel@gmail.com>2021-02-15 22:17:50 +0300
committerAnkit Meel <ankitjmeel@gmail.com>2021-02-15 22:17:50 +0300
commit7baf796886b26e638c87c8c6533b7dc6e9b3803c (patch)
tree73610945a13f9a9e4a9d83ffdb9d7334bac0dae5 /build_files
parent35145db056fccff0895a5366a72ad8b43b137e9b (diff)
macOS Deps: NumPy: Remove buggy Accelerate framework
Building NumPy from source with default options of builder causes it to link against Accelerate framework which is buggy and raises a warning mentioned in [2]. "RankWarning: Polyfit may be poorly conditioned" Accelerate is deprecated with NumPy 1.20+.[1] So either we build OpenBLAS in dependencies also and set appropriate env variables suggested in [1] while building NumPy for it to find OpenBLAS. Or download NumPy wheel from pip and never allow pip to build NumPy from source while installing. After this change, pip wheels are used for NumPy for macOS with x86_64. [1] https://numpy.org/doc/stable/user/building.html#lapack [2] https://github.com/numpy/numpy/issues/15947 Reviewed By: #platform_macos, sebbas Differential Revision: https://developer.blender.org/D10368
Diffstat (limited to 'build_files')
-rw-r--r--build_files/build_environment/CMakeLists.txt7
-rw-r--r--build_files/build_environment/cmake/python_site_packages.cmake9
2 files changed, 15 insertions, 1 deletions
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt
index 8d6fd3ab4c3..10dbc41bef4 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -86,9 +86,14 @@ include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
include(cmake/nanovdb.cmake)
include(cmake/python.cmake)
+option(USE_PIP_NUMPY "Install NumPy using pip wheel instead of building from source" OFF)
+if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
+ set(USE_PIP_NUMPY ON)
+else()
+ include(cmake/numpy.cmake)
+endif()
include(cmake/python_site_packages.cmake)
include(cmake/package_python.cmake)
-include(cmake/numpy.cmake)
include(cmake/usd.cmake)
include(cmake/potrace.cmake)
include(cmake/haru.cmake)
diff --git a/build_files/build_environment/cmake/python_site_packages.cmake b/build_files/build_environment/cmake/python_site_packages.cmake
index a3b9c3bf796..2b75a6a244f 100644
--- a/build_files/build_environment/cmake/python_site_packages.cmake
+++ b/build_files/build_environment/cmake/python_site_packages.cmake
@@ -28,6 +28,15 @@ ExternalProject_Add(external_python_site_packages
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} chardet==${CHARDET_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} --no-binary :all:
)
+if(USE_PIP_NUMPY)
+ # Use only wheel (and not build from source) to stop NumPy from linking against buggy
+ # Accelerate framework backend on macOS. Official wheels are built with OpenBLAS.
+ ExternalProject_Add_Step(external_python_site_packages after_install
+ COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir numpy==${NUMPY_VERSION} --only-binary :all:
+ DEPENDEES install
+ )
+endif()
+
add_dependencies(
external_python_site_packages
external_python