pyvalhalla icon indicating copy to clipboard operation
pyvalhalla copied to clipboard

PyValhalla for mac os arm

Open baileyheading opened this issue 1 year ago • 8 comments

Hi,

I managed to hack PyValhalla to run a Mac os arm valhalla build I made a week or so ago

Once the isochrone issues I encountered are sorted, I should be able to help out with the build process for PyValhalla

Can't say I know exactly what is going on in the build scripts here, but to me it looks like the main thing to change from "build_mac.sh" would be pathing to the mac os arm location

baileyheading avatar May 23 '23 03:05 baileyheading

That'd be really nice to have a user reporting how to do it.

Not sure we'd ever really have a pipeline to publish M1 binaries on PyPI as long as there's no easily accessible & free M1 runners on GHA. It can be done locally as well (build all minor Python versions separately and publish them manually), but it's painful and I can tell 100% that no one would commit to that long-term (or very soon un-commit after starting;)).

nilsnolde avatar May 23 '23 17:05 nilsnolde

It seems this is on the GitHub roadmap for Q4 2023

https://github.com/github/roadmap/issues/528

image

baileyheading avatar May 24 '23 01:05 baileyheading

It seems GitHub has added support for ARM based distributions of macOS. It would be an amazing improvement to DX if Valhalla's python bindings work on ARM Macs.

kkostov avatar Mar 01 '24 13:03 kkostov

yeah, we're already using that in upstream valhalla to build.

to be clear, python bindings are working for apple silicon, they're just not distributed on pypi. fwiw, it'd be better to do the packaging directly in valhalla as part of our release workflow. but that'll need quite a bit of work, especially for linux.

if someone is really interested, over [email protected] I'm open for this type of commercial enquiries.

nilsnolde avatar Mar 01 '24 14:03 nilsnolde

I basically just pip installed PyValhalla for Mac Intel, built Valhalla for Mac ARM, then copied the PyValhalla site_packages stuff from python Intel env into a new python arm env and replaced it with the stuff I built (and renamed a few things until errors went away). Valhalla in ARM is a little faster, but the most significant gain is that you can run your regular python code in ARM.

baileyheading avatar Mar 02 '24 03:03 baileyheading

Easiest is probably to just “sudo” install all of Valhalla, which will also install the Python bindings in the right place, unless you have a strange Python setup .

nilsnolde avatar Mar 02 '24 08:03 nilsnolde

Things can get a bit messy if you have different environments (I like to use Conda) and Rosetta intel + arm environments. I had such a hard time getting it to use the exact python version I wanted I gave up and hardcoded it into the CMake in Valhalla (pro move)

baileyheading avatar Mar 02 '24 11:03 baileyheading

Haha yeah I can imagine. In theory I guess CMake should make it easy via some variables but I can imagine it's not necessarily working as expected always.. At least Valhalla is not relying on Rosetta stuff anymore and can be installed natively now on apple silicon.

nilsnolde avatar Mar 02 '24 12:03 nilsnolde