cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

Installing CadQuery with Pip3 on arm64 Apple M1

Open jeremiahrose opened this issue 1 year ago • 3 comments

Just posting this here for future reference, as I couldn't find this solution anywhere in the README or in past issues on this topic.

I was able to install cadquery on my M1 Mac using the following steps:

  1. Make sure Xcode command line tools and Python3 are installed (assuming you are not using *conda)
  2. Upgrade pip like python3 -m pip install --upgrade pip
  3. Add the following requirements.txt to your project:
cadquery
cadquery-ocp == 7.7.1
pyparsing >= 2.1.9
sphinx == 5.0.1
sphinx_rtd_theme
black == 19.10b0
click == 8.0.4
mypy
codecov
pytest
pytest-cov
ezdxf
typing_extensions
nptyping == 2.0.1
nlopt
path
casadi
multimethod  >= 1.7,<2.0
typish
  1. Install the intel versions of these packages: arch -arch x86_64 pip3 install -r requirements.txt
  2. Run the intel version of cadquery and check that it's working:
arch -arch x86_64 python3
>>> import cadquery
>>> cadquery.Workplane('XY').box(1,2,3).toSvg()

jeremiahrose avatar Nov 03 '23 06:11 jeremiahrose

I think the "better" way to do this is to use https://github.com/CadQuery/ocp-build-system to extract a python wheel from conda, which involves installing M1 OCP from conda and then extracting the wheel using python setup.py bdist_wheel. This method should have much better performance

akoen avatar Nov 03 '23 21:11 akoen

Thank you @akoen! Followed your suggestion and it worked after a while. Had to build wheel for nlopt as well since that didn't have pypi dist for arm64 either.

I published the resulting wheels and some instructions on how to use them with poetry here: https://github.com/biggestT/cadquery-dist-macos-arm64

at least the cadquery.Workplane('XY').box(1,2,3).toSvg() works now

biggestT avatar Nov 08 '23 10:11 biggestT

Awesome, great work!

akoen avatar Nov 08 '23 17:11 akoen