PyO3 / maturin-action

GitHub Action to install and run a custom maturin command with built-in support for cross compilation
MIT License
123 stars 31 forks source link

Seems not to work with Anaconda environments on CI #251

Closed milesgranger closed 3 months ago

milesgranger commented 3 months ago

I was dabbling in some build issues, and found using anaconda got me further along for compilation purposes but then maturin-action failed to detect the anaconda / miniconda python:

Caused by: Couldn't find any python interpreters from 'python'. Error: The process '/Users/runner/work/_temp/73060e8d-05b1-47da-b679-cbab2af306a9/maturin' failed with exit code 1 at ExecState._setResult (/Users/runner/work/_actions/PyO3/maturin-action/v1/dist/index.js:1702:25) at ExecState.CheckComplete (/Users/runner/work/_actions/PyO3/maturin-action/v1/dist/index.js:1685:18) at ChildProcess. (/Users/runner/work/_actions/PyO3/maturin-action/v1/dist/index.js:1579:27) at ChildProcess.emit (node:events:514:28) at maybeClose (node:internal/child_process:1105:16) at ChildProcess._handle.onexit (node:internal/child_process:305:5) Error: The process '/Users/runner/work/_temp/73060e8d-05b1-47da-b679-cbab2af306a9/maturin' failed with exit code 1

https://github.com/milesgranger/cramjam/actions/runs/8359249363/job/22882184867#step:7:76

I've tried removing -i python but then it'll just use the system python 3.11 for this example. I've also tried exporting the python location before and referencing it as an env var but it seems it evaluates it literally saying something along the lines of "can't find $PYTHON, available choices ..."

I think at this point I'm just doing something dumb. Do you know of any CI's successfully using anaconda/miniconda with maturin-action?

messense commented 3 months ago

Do you know of any CI's successfully using anaconda/miniconda with maturin-action?

No, I don't have much experience with conda.

Your issue is probably because macos-14 runner is arm64 while you are trying to cross compile a x86_64 wheel, in this case -i python isn't valid, you need to use the PYO3_CROSS_LIB_DIR and etc.

milesgranger commented 3 months ago

Thanks for the tips. :+1:

milesgranger commented 3 months ago

Okay, apologies again but I've switched back to macos-13 and setting PYO3_PYTHON and other variables: https://github.com/milesgranger/cramjam/actions/runs/8375430282/job/22932748794?pr=107#step:6:4

but then it only builds for the system 3.9: https://github.com/milesgranger/cramjam/actions/runs/8375430282/job/22932748794?pr=107#step:8:159

messense commented 3 months ago

Check your env vars, it's PYO3_CROSS_LIB_DIR not PYO3_LIB_DIR.

milesgranger commented 3 months ago

oh, hmm, I thought since I was no longer on arm64, it would not be cross vars; change now but still failing w/ a different reason. I'll stop bothering you. :sweat_smile: