Skip to content

Commit ae86d8f

Browse files
authored
Merge pull request #85 from IntelPython/add-wheel-pkgs
Add building wheel packages
2 parents 8d05d43 + 9adf060 commit ae86d8f

File tree

9 files changed

+125
-16
lines changed

9 files changed

+125
-16
lines changed

.github/workflows/conda-package.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ jobs:
5555
- name: Install conda-build
5656
run: conda install conda-build
5757

58+
- name: Store conda paths as envs
59+
shell: bash -el {0}
60+
run: |
61+
echo "CONDA_BLD=/usr/share/miniconda/conda-bld/linux-64/" >> $GITHUB_ENV
62+
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE/" >> $GITHUB_ENV
63+
5864
- name: Build conda package
5965
run: |
6066
CHANNELS="-c conda-forge -c https://software.repos.intel.com/python/conda --override-channels"
@@ -71,16 +77,20 @@ jobs:
7177
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
7278
with:
7379
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
74-
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda
80+
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
81+
82+
- name: Upload wheels artifact
83+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
84+
with:
85+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
86+
path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl
7587

7688
build_windows:
7789
runs-on: windows-latest
7890

7991
strategy:
8092
matrix:
8193
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
82-
env:
83-
conda-bld: C:\Miniconda\conda-bld\win-64\
8494

8595
steps:
8696
- name: Cancel Previous Runs
@@ -115,14 +125,26 @@ jobs:
115125
- name: Setup MSVC
116126
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
117127

128+
- name: Store conda paths as envs
129+
shell: bash -el {0}
130+
run: |
131+
echo "CONDA_BLD=C:\\Miniconda\\conda-bld\\win-64\\" >> $GITHUB_ENV
132+
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE\\" >> $GITHUB_ENV
133+
118134
- name: Build conda package
119135
run: conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
120136

121137
- name: Upload artifact
122138
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
123139
with:
124140
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
125-
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.conda
141+
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
142+
143+
- name: Upload wheels artifact
144+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
145+
with:
146+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
147+
path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl
126148

127149
test_linux:
128150
needs: build_linux

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [2.5.0] (05/DD/2025)
7+
## [2.5.1] (06/27/2025)
8+
9+
### Fixed
10+
* Resolved import issue in the virtual environment which broke loading of MKL libs [gh-85](github.com/IntelPython/mkl-service/pull/85)
11+
12+
## [2.5.0] (06/03/2025)
813

914
### Added
1015
* Added support for python 3.13 [gh-72](github.com/IntelPython/mkl-service/pull/72)

conda-recipe/bld.bat

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
1-
2-
@rem Remember to activate compiler, if needed
1+
echo on
2+
rem set CFLAGS=-I%PREFIX%\Library\include %CFLAGS%
3+
rem set LDFLAGS=/LIBPATH:%PREFIX% %LDFLAGS%
34

45
set MKLROOT=%CONDA_PREFIX%
5-
%PYTHON% -m pip install --no-build-isolation --no-deps .
6-
if errorlevel 1 exit 1
6+
7+
"%PYTHON%" setup.py clean --all
8+
9+
:: Make CMake verbose
10+
set "VERBOSE=1"
11+
12+
:: -wnx flags mean: --wheel --no-isolation --skip-dependency-check
13+
%PYTHON% -m build -w -n -x
14+
if %ERRORLEVEL% neq 0 exit 1
15+
16+
:: wheel file was renamed
17+
for /f %%f in ('dir /b /S .\dist') do (
18+
%PYTHON% -m pip install %%f ^
19+
--no-build-isolation ^
20+
--no-deps ^
21+
--only-binary :all: ^
22+
--no-index ^
23+
--prefix %PREFIX% ^
24+
-vv
25+
if %ERRORLEVEL% neq 0 exit 1
26+
)
27+
28+
:: Copy wheel package
29+
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
30+
copy dist\mkl_service*.whl %WHEELS_OUTPUT_FOLDER%
31+
if %ERRORLEVEL% neq 0 exit 1
32+
)

conda-recipe/build.sh

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
1-
#!/bin/bash -x
1+
#!/bin/bash
2+
set -ex
23

3-
# make sure that compiler has been sourced, if necessary
4+
export MKLROOT=$CONDA_PREFIX
45

5-
MKLROOT=$CONDA_PREFIX $PYTHON -m pip install --no-build-isolation --no-deps .
6+
read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \
7+
| tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')"
8+
9+
${PYTHON} setup.py clean --all
10+
11+
# Make CMake verbose
12+
export VERBOSE=1
13+
14+
# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
15+
${PYTHON} -m build -w -n -x
16+
17+
${PYTHON} -m wheel tags --remove \
18+
--platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" \
19+
dist/mkl_service*.whl
20+
21+
${PYTHON} -m pip install dist/mkl_service*.whl \
22+
--no-build-isolation \
23+
--no-deps \
24+
--only-binary :all: \
25+
--no-index \
26+
--prefix "${PREFIX}" \
27+
-vv
28+
29+
# Copy wheel package
30+
if [[ -d "${WHEELS_OUTPUT_FOLDER}" ]]; then
31+
cp dist/mkl_service*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
32+
fi

conda-recipe/conda_build_config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
c_compiler: # [linux]
2+
- gcc # [linux]
3+
cxx_compiler: # [linux]
4+
- gxx # [linux]
5+
cxx_compiler_version: # [linux]
6+
- '14' # [linux]
7+
c_stdlib: # [linux]
8+
- sysroot # [linux]
9+
c_stdlib_version: # [linux]
10+
- '2.28' # [linux]
11+
c_stdlib: # [win]
12+
- vs # [win]
13+
cxx_compiler: # [win]
14+
- vs2022 # [win]
15+
c_compiler: # [win]
16+
- vs2022 # [win]

conda-recipe/meta.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% set version = "2.5.0" %}
1+
{% set version = "2.5.1" %}
22
{% set buildnumber = 0 %}
33

44
package:
@@ -10,21 +10,27 @@ source:
1010

1111
build:
1212
number: {{ buildnumber }}
13+
script_env:
14+
- WHEELS_OUTPUT_FOLDER
1315
ignore_run_exports:
1416
- blas
1517
- mkl-service
1618

1719
requirements:
1820
build:
1921
- {{ compiler('c') }}
22+
- {{ stdlib('c') }}
2023
host:
2124
- python
25+
- pip >=25.0
2226
- setuptools >=77
2327
- mkl-devel
2428
- cython
29+
- wheel >=0.45.1
30+
- python-build >=1.2.2
2531
run:
2632
- python
27-
- mkl
33+
- {{ pin_compatible('mkl') }}
2834

2935
test:
3036
requires:

mkl/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.5.0"
1+
__version__ = "2.5.1"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
[build-system]
2727
build-backend = "setuptools.build_meta"
28-
requires = ["setuptools>=77", "Cython"]
28+
requires = ["setuptools>=77", "Cython", "wheel>=0.45.1", "build>=1.2.2"]
2929

3030
[project]
3131
authors = [

setup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626

2727
import os
28+
import sys
2829
from os.path import join
2930

3031
import Cython.Build
@@ -42,9 +43,13 @@ def extensions():
4243
else:
4344
raise ValueError("MKLROOT environment variable not set.")
4445

46+
if sys.platform != "win32":
47+
mkl_info["rpaths"] = ["$ORIGIN/../..", "$ORIGIN/../../.."]
48+
4549
mkl_include_dirs = mkl_info.get("include_dirs", [])
4650
mkl_library_dirs = mkl_info.get("library_dirs", [])
4751
mkl_libraries = mkl_info.get("libraries", ["mkl_rt"])
52+
mkl_rpaths = mkl_info.get("rpaths", [])
4853

4954
defs = []
5055
if any(["mkl_rt" in li for li in mkl_libraries]):
@@ -59,6 +64,7 @@ def extensions():
5964
include_dirs=mkl_include_dirs,
6065
libraries=mkl_libraries + (["pthread"] if os.name == "posix" else []),
6166
library_dirs=mkl_library_dirs,
67+
runtime_library_dirs=mkl_rpaths,
6268
extra_compile_args=[
6369
"-DNDEBUG"
6470
# "-g", "-O2", "-Wall",
@@ -74,6 +80,7 @@ def extensions():
7480
include_dirs=mkl_include_dirs,
7581
library_dirs=mkl_library_dirs,
7682
libraries=mkl_libraries,
83+
runtime_library_dirs=mkl_rpaths,
7784
extra_compile_args=[
7885
"-DNDEBUG"
7986
# "-g", "-O2", "-Wall",

0 commit comments

Comments
 (0)