diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index b11072e..d4e7e69 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -55,6 +55,12 @@ jobs: - name: Install conda-build run: conda install conda-build + - name: Store conda paths as envs + shell: bash -el {0} + run: | + echo "CONDA_BLD=/usr/share/miniconda/conda-bld/linux-64/" >> $GITHUB_ENV + echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE/" >> $GITHUB_ENV + - name: Build conda package run: | CHANNELS="-c conda-forge -c https://software.repos.intel.com/python/conda --override-channels" @@ -71,7 +77,13 @@ jobs: uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda + path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda + + - name: Upload wheels artifact + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }} + path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl build_windows: runs-on: windows-latest @@ -79,8 +91,6 @@ jobs: strategy: matrix: python: ['3.9', '3.10', '3.11', '3.12', '3.13'] - env: - conda-bld: C:\Miniconda\conda-bld\win-64\ steps: - name: Cancel Previous Runs @@ -115,6 +125,12 @@ jobs: - name: Setup MSVC uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + - name: Store conda paths as envs + shell: bash -el {0} + run: | + echo "CONDA_BLD=C:\\Miniconda\\conda-bld\\win-64\\" >> $GITHUB_ENV + echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE\\" >> $GITHUB_ENV + - name: Build conda package run: conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe @@ -122,7 +138,13 @@ jobs: uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.conda + path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda + + - name: Upload wheels artifact + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }} + path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl test_linux: needs: build_linux diff --git a/CHANGELOG.md b/CHANGELOG.md index 568f496..7847984 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2.5.0] (05/DD/2025) +## [2.5.1] (06/27/2025) + +### Fixed +* Resolved import issue in the virtual environment which broke loading of MKL libs [gh-85](github.com/IntelPython/mkl-service/pull/85) + +## [2.5.0] (06/03/2025) ### Added * Added support for python 3.13 [gh-72](github.com/IntelPython/mkl-service/pull/72) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 0eddfe9..90a55f4 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -1,6 +1,32 @@ - -@rem Remember to activate compiler, if needed +echo on +rem set CFLAGS=-I%PREFIX%\Library\include %CFLAGS% +rem set LDFLAGS=/LIBPATH:%PREFIX% %LDFLAGS% set MKLROOT=%CONDA_PREFIX% -%PYTHON% -m pip install --no-build-isolation --no-deps . -if errorlevel 1 exit 1 + +"%PYTHON%" setup.py clean --all + +:: Make CMake verbose +set "VERBOSE=1" + +:: -wnx flags mean: --wheel --no-isolation --skip-dependency-check +%PYTHON% -m build -w -n -x +if %ERRORLEVEL% neq 0 exit 1 + +:: wheel file was renamed +for /f %%f in ('dir /b /S .\dist') do ( + %PYTHON% -m pip install %%f ^ + --no-build-isolation ^ + --no-deps ^ + --only-binary :all: ^ + --no-index ^ + --prefix %PREFIX% ^ + -vv + if %ERRORLEVEL% neq 0 exit 1 +) + +:: Copy wheel package +if NOT "%WHEELS_OUTPUT_FOLDER%"=="" ( + copy dist\mkl_service*.whl %WHEELS_OUTPUT_FOLDER% + if %ERRORLEVEL% neq 0 exit 1 +) diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index df09449..6bfa533 100644 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -1,5 +1,32 @@ -#!/bin/bash -x +#!/bin/bash +set -ex -# make sure that compiler has been sourced, if necessary +export MKLROOT=$CONDA_PREFIX -MKLROOT=$CONDA_PREFIX $PYTHON -m pip install --no-build-isolation --no-deps . +read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \ + | tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')" + +${PYTHON} setup.py clean --all + +# Make CMake verbose +export VERBOSE=1 + +# -wnx flags mean: --wheel --no-isolation --skip-dependency-check +${PYTHON} -m build -w -n -x + +${PYTHON} -m wheel tags --remove \ + --platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" \ + dist/mkl_service*.whl + +${PYTHON} -m pip install dist/mkl_service*.whl \ + --no-build-isolation \ + --no-deps \ + --only-binary :all: \ + --no-index \ + --prefix "${PREFIX}" \ + -vv + +# Copy wheel package +if [[ -d "${WHEELS_OUTPUT_FOLDER}" ]]; then + cp dist/mkl_service*.whl "${WHEELS_OUTPUT_FOLDER[@]}" +fi diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml new file mode 100644 index 0000000..d4b34a3 --- /dev/null +++ b/conda-recipe/conda_build_config.yaml @@ -0,0 +1,16 @@ +c_compiler: # [linux] + - gcc # [linux] +cxx_compiler: # [linux] + - gxx # [linux] +cxx_compiler_version: # [linux] + - '14' # [linux] +c_stdlib: # [linux] + - sysroot # [linux] +c_stdlib_version: # [linux] + - '2.28' # [linux] +c_stdlib: # [win] + - vs # [win] +cxx_compiler: # [win] + - vs2022 # [win] +c_compiler: # [win] + - vs2022 # [win] diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 33c683a..259158a 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "2.5.0" %} +{% set version = "2.5.1" %} {% set buildnumber = 0 %} package: @@ -10,6 +10,8 @@ source: build: number: {{ buildnumber }} + script_env: + - WHEELS_OUTPUT_FOLDER ignore_run_exports: - blas - mkl-service @@ -17,14 +19,18 @@ build: requirements: build: - {{ compiler('c') }} + - {{ stdlib('c') }} host: - python + - pip >=25.0 - setuptools >=77 - mkl-devel - cython + - wheel >=0.45.1 + - python-build >=1.2.2 run: - python - - mkl + - {{ pin_compatible('mkl') }} test: requires: diff --git a/mkl/_version.py b/mkl/_version.py index 50062f8..7a2056f 100644 --- a/mkl/_version.py +++ b/mkl/_version.py @@ -1 +1 @@ -__version__ = "2.5.0" +__version__ = "2.5.1" diff --git a/pyproject.toml b/pyproject.toml index 2efd692..f8c4837 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ [build-system] build-backend = "setuptools.build_meta" -requires = ["setuptools>=77", "Cython"] +requires = ["setuptools>=77", "Cython", "wheel>=0.45.1", "build>=1.2.2"] [project] authors = [ diff --git a/setup.py b/setup.py index b5fcc2b..23bac56 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ import os +import sys from os.path import join import Cython.Build @@ -42,9 +43,13 @@ def extensions(): else: raise ValueError("MKLROOT environment variable not set.") + if sys.platform != "win32": + mkl_info["rpaths"] = ["$ORIGIN/../..", "$ORIGIN/../../.."] + mkl_include_dirs = mkl_info.get("include_dirs", []) mkl_library_dirs = mkl_info.get("library_dirs", []) mkl_libraries = mkl_info.get("libraries", ["mkl_rt"]) + mkl_rpaths = mkl_info.get("rpaths", []) defs = [] if any(["mkl_rt" in li for li in mkl_libraries]): @@ -59,6 +64,7 @@ def extensions(): include_dirs=mkl_include_dirs, libraries=mkl_libraries + (["pthread"] if os.name == "posix" else []), library_dirs=mkl_library_dirs, + runtime_library_dirs=mkl_rpaths, extra_compile_args=[ "-DNDEBUG" # "-g", "-O2", "-Wall", @@ -74,6 +80,7 @@ def extensions(): include_dirs=mkl_include_dirs, library_dirs=mkl_library_dirs, libraries=mkl_libraries, + runtime_library_dirs=mkl_rpaths, extra_compile_args=[ "-DNDEBUG" # "-g", "-O2", "-Wall",