casacore / python-casacore

Python bindings for casacore, a library used in radio astronomy
http://casacore.github.io/python-casacore
GNU Lesser General Public License v3.0
35 stars 22 forks source link

Test cibuildwheel for macOS wheels #232

Open ludwigschwardt opened 2 years ago

ludwigschwardt commented 2 years ago

I'm trying out a basic cibuildwheel workflow just for macOS wheels for now.

The main aim is to get those sweet arm64 wheels for Apple Silicon (M1) processors. 😁

On success this could be extended to manylinux wheels too...

tammojan commented 2 years ago

That would be very welcome! You probably noticed, but the address of the measures data is ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar

ludwigschwardt commented 2 years ago

Yes, just discovered that 🙂 I had hoped that this pull request would also exercise the new workflow but it didn't...

I'm restarting my effort on my own fork in master branch to test this, then I'll add some more commits to this branch (or PR the fork).

ludwigschwardt commented 2 years ago

The one issue is boost (as always!). I'll check if there's a way to make multiple pythons with their corresponding boosts without compiling casacore 5-15 times :-)

tammojan commented 2 years ago

I'm gaining more experience with pybind11 in other projects. Porting python-casacore to pybind11 is (still) on my todo-list, but I'm getting more optimistic that it's easy.

ludwigschwardt commented 2 years ago

Yes, long-term that's probably the best solution.

ludwigschwardt commented 2 years ago

Unfortunately this looks like a dead end for M1 wheels... for now.

I've successfully built arm64 wheels for python-gnureadline using cibuildwheel, but there I'm compiling readline myself as a universal binary. The wheel machinery then strips the dylib appropriately to produce x86_64, arm64 and universal2 wheels.

The problem here is that we also need to link in the casacore dylibs. Since the macOS runner uses Homebrew and is intel only at this point, you'll get single-arch x86_64 casacore. (Homebrew won't support universal builds anymore.)

Once we have M1 runners in GitHub Actions we'll be sorted (at least for single-arch wheels), but that could still take a while.

I should have an M1 laptop soon, and then I'll experiment with direct installation of this package and producing some arm64 wheels to help out. I could also potentially offer the laptop as a remote runner to go this route :-) Leaving the PR open for now to investigate the latter option soon.

tammojan commented 2 years ago

@ludwigschwardt Once your laptop arrives, you could try the newest M1 wheel for python-casacore 3.5.

ludwigschwardt commented 10 months ago

Update:

The one sad part is that I was waiting for M1 GitHub runners to simplify building and testing. They have finally arrived in October but you have to pay for them 🤦🏼‍♂️

As it stands, you need to build M1 wheels on an M1, because you have to link against libcasacore and if you use Homebrew for that you won't get a universal binary but one which reflects the runner's environment.

I was thinking of building those wheels on my laptop for starters. Alternatively we need to build libcasacore outside Homebrew.