ERROR: Python dependency not found (on Windows) #558
-
We're trying to build a wheel for a Cython project through github workflows on Windows. The build is failing pretty early on. The question spans github actions, cibuildwheel, and meson-python -- hopefully, it's not off-topic here. Top level meson.build begins with:
Here's the error:
We're following the example of SciPy pretty closely. Our project is simpler (no Fortran or C++), but we don't see what we're doing differently in this area. Here's part of the github workflows script: yaml
jobs:
build_wheels:
name: Build wheel for ${{matrix.python[0]}}-${{matrix.buildplat[1]}} ${{matrix.buildplat[2]}}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
matrix:
buildplat:
# - [ubuntu-22.04, manylinux, x86_64]
# - [macos-11, macosx, x86_64]
- [windows-2019, win, AMD64]
python:
# - ["cp38", "3.8"]
# - ["cp39", "3.9"]
- ["cp310", "3.10"]
# - ["cp311", "3.11"]
# - ["cp312", "3.12"]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Rtools (Windows)
# Rtools provides pkg-config on Windows
if: ${{ runner.os == 'Windows' }}
run: |
choco install rtools -y --no-progress --force --version=4.0.0.20220206
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
- name: Install cibuildwheel and twine
run: |
python -m pip install --upgrade pip
pip install cibuildwheel twine
- name: Install Libvna (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
python3 .github/tools/download-libvna-windows
New-Item -Path C:\opt -ItemType Directory -Force
Expand-Archive -Path libvna-windows-x86_64.zip -DestinationPath C:\opt
echo 'C:\opt\libvna-windows-x86_64\bin;' >> $env:GITHUB_PATH
Write-Host "GITHUB_PATH=$env:GITHUB_PATH"
- name: Build Wheels
env:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT: "PIP_NO_BUILD_ISOLATION=false PIP_PRE=1"
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
CIBW_PRERELEASE_PYTHONS: True
CIBW_BEFORE_BUILD_LINUX: |
echo "WHOAMI=`whoami`"
echo "UNAME=`uname -a`"
set -e
yum install -y gcc libyaml-devel
pip install requests
python3 .github/tools/install-libvna-rpm
CIBW_ENVIRONMENT_WINDOWS: >
PKG_CONFIG_PATH=c:/opt/libvna-windows-x86_64/lib/pkgconfig
PIP_PRE=1
PIP_NO_BUILD_ISOLATION=false
CIBW_BEFORE_BUILD_WINDOWS:
pip install numpy>=2.0.0.dev0 meson-python cython!=3.0.3 ninja &&
bash {project}/tools/test-script &&
powershell -Command "Write-Host GITHUB_PATH=$env:GITHUB_PATH"
CIBW_BEFORE_BUILD_MACOS: |
pip install numpy>=2.0.0.dev0 meson-python cython!=3.0.3 ninja
brew tap scott-guthridge/extra
brew install scott-guthridge/extra/libvna
run: python -m cibuildwheel --output-dir wheelhouse Linux and MacOs builds are running without errors. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
The only thing that stands out as possibly causing the issue is setting Other than that, why are you setting the |
Beta Was this translation helpful? Give feedback.
-
I would go the other way around: start with a barebone setup and add the things you need one after the other. Building wheels using meson-python does not require anything special. For a simple example you can look here https://github.com/dnicolodi/python-siphash24/blob/master/.github/workflows/wheels.yml |
Beta Was this translation helpful? Give feedback.
-
It may not be the source of your issue, but you need to also have |
Beta Was this translation helpful? Give feedback.
-
Thank you, everyone. Adding 'c' to the project line fixed this problem. |
Beta Was this translation helpful? Give feedback.
What @dnicolodi suggests below should indeed fix this I think. If you change the first line of your
meson.build
to:things should work.
The dependency detection for Python is going to look for the
Python.h
header and it needs a C (or C++) compiler for that.