First time here? Checkout the FAQ!
0 votes
by (17.5k points)
In general, openCARP compiles well natively on machines equipped with an Apple M1 processor.

Some dependencies are a little bit tricky, though. See below for instruction that worked for me.

1 Answer

+1 vote
by (17.5k points)
edited by

In general, follow the build instructions:

Some peculiarities:

Homebrew works on M1 machines, however the packages are not installed in /usr/local but /opt/homebrew. It is not recommended to change that (and my attempts to do so were not successful). 

  • The resulting non-standard paths require some environment variables to be set: 
    • export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
    • export HDF5_DIR=/opt/homebrew
    • export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/llvm/bin:$PATH" 
    • export BLAS=/opt/homebrew/Cellar/lapack/3.9.0_1/lib/libblas.dylib
    • export LAPACK=/opt/homebrew/Cellar/lapack/3.9.0_1/lib/liblapack.dylib 
  • Make sure to install libjpeg, c-blosc, llvm and python@3.8 from homebrew. Some of the carputils dependencies (e.g. tables) do not yet work properly with Python 3.9 as of now. However, homebrew also requires Python 3.9. Thus, you'll need both versions installed. To use 3.8 by default, run
    • brew install python@3.8
    • brew unlink python@3.9
    • brew link python@3.8
  • Make sure the directory /usr/local/bin exists

The hardest part was to get all python dependencies installed. The following worked for me:

Then, remove the version specifications from carputils/requirements.py3.txt for numpypandas and scipy. After that, pip3 install --user -r requirements.txt should run fine.

When compiling meshtool, you also need to provide the non-standard path for libomp:

  • In openCARP/_build/external/meshtool/src/meshtool/switches.def, add -L/opt/homebrew/opt/llvm/lib to the end of line 26. In openCARP/_build/external/meshtool/src/meshtool/my_switches.def, make sure to use clang as compiler

Meshalyzer compiled without problems using the CMake workflow.

by (150 points)

I finally managed to install openCARP on a MAC M1 machine.

Now I followed this instruction to install carputils,
-> python --version
    Python 3.8.14
after running 'python -m pip install --no-binary :all: --no-use-pep517 numpy', I get  'error: subprocess-exited-with-error'

I appreciate any suggestion/help.


DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at
Collecting numpy
  Using cached numpy-1.23.3.tar.gz (10.7 MB)
  Preparing metadata ( ... error
  error: subprocess-exited-with-error
  × python egg_info did not run successfully.
  │ exit code: 1
  ╰─> [75 lines of output]
      running egg_info
      running build_src
      INFO: build_src
      creating /private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-pip-egg-info-v0mcicc5/numpy.egg-info
      writing /private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-pip-egg-info-v0mcicc5/numpy.egg-info/PKG-INFO
      writing dependency_links to /private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-pip-egg-info-v0mcicc5/numpy.egg-info/dependency_links.txt
      writing entry points to /private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-pip-egg-info-v0mcicc5/numpy.egg-info/entry_points.txt
      writing top-level names to /private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-pip-egg-info-v0mcicc5/numpy.egg-info/top_level.txt
      writing manifest file '/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-pip-egg-info-v0mcicc5/numpy.egg-info/SOURCES.txt'
      INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
      Running from numpy source directory.
      /private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/ DeprecationWarning:
        `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
        of the deprecation of `distutils` itself. It will be removed for
        Python >= 3.12. For older Python versions it will remain present.
        It is recommended to use `setuptools < 60.0` for those Python versions.
        For more details, see:

        import numpy.distutils.command.sdist
      /opt/homebrew/lib/python3.8/site-packages/setuptools/command/ SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
      Please extend command classes from setuptools instead of distutils.
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/", line 494, in <module>
        File "/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/", line 486, in setup_package
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/", line 185, in setup
          return run_commands(dist)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/", line 201, in run_commands
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/", line 973, in run_commands
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/", line 1217, in run_command
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/", line 992, in run_command

        File "/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/numpy/distutils/command/", line 25, in run

        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 308, in run
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 316, in find_sources

        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 560, in run
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 597, in add_defaults
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 107, in add_defaults
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 127, in _add_defaults_build_sub_commands
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 503, in extend
          self.files.extend(filter(self._safe_path, paths))
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 126, in <genexpr>
          files = (c.get_source_files() for c in cmds if hasattr(c, "get_source_files"))
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/", line 125, in <genexpr>
          cmds = (self.get_finalized_command(c) for c in missing_cmds)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/", line 306, in get_finalized_command
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/", line 109, in ensure_finalized
        File "/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/numpy/distutils/command/", line 69, in finalize_options
          v = getattr(c, a)
        File "/opt/homebrew/lib/python3.8/site-packages/Cython/Distutils/", line 157, in __getattr__
          return _build_ext.build_ext.__getattr__(self, name)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/", line 105, in __getattr__
          raise AttributeError(attr)
      AttributeError: fcompiler
      [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
by (17.5k points)
Hi Fatemeh,

the specific instructions were compiled a while ago while some packages were not yet available for M1. Maybe by now the standard way of installing the developer setup of carputils also works on M1. For this, I'd run the following commands:
   pip3 uninstall carputils -y
   python3 -m pip install --upgrade pip
   python3 -m pip install --upgrade setuptools

Then, follow the instructions here to actually install carputils

If an issue with tables occurs, you likely need to install HDF5 before as described here:
by (150 points)
Hi Alex,

Thanks for the tip,

At the moment, I excluded carputils on mac M1, which I will be back to this issue soon. and I would like first to compile opencarp without carputils.
when I run make in opencarp, I have an error which I explained it in the following link.

I appreciate any suggestion/ help.
by (150 points)
Thanks alot Axel, I managed to run carputils on mac M1 machine by following your instruction.

For me to install scipy I run the following which works for me.

pip install --pre -i scipy
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance