First time here? Checkout the FAQ!
x
0 votes
by (19.1k 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 (19.1k points)
edited by

In general, follow the build instructions: https://opencarp.org/download/installation#building-from-source

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)
Hi,

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

Now I followed this instruction to install carputils,
FYI:
-> 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.

Best,
Fatemeh


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 https://github.com/Homebrew/homebrew-core/issues/76621
Collecting numpy
  Using cached numpy-1.23.3.tar.gz (10.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py 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/setup.py:86: 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:
          https://numpy.org/devdocs/reference/distutils_status_migration.html
      
      
        import numpy.distutils.command.sdist
      /opt/homebrew/lib/python3.8/site-packages/setuptools/command/egg_info.py:643: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
      Please extend command classes from setuptools instead of distutils.
        warnings.warn(
      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/setup.py", line 494, in <module>
          setup_package()
        File "/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/setup.py", line 486, in setup_package
          setup(**metadata)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
          self.run_command(cmd)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/numpy/distutils/command/egg_info.py", line 25, in run
          _egg_info.run(self)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 308, in run
          self.find_sources()
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 316, in find_sources
          mm.run()
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 560, in run
          self.add_defaults()
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 597, in add_defaults
          sdist.add_defaults(self)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/sdist.py", line 107, in add_defaults
          self._add_defaults_build_sub_commands()
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/sdist.py", line 127, in _add_defaults_build_sub_commands
          self.filelist.extend(chain.from_iterable(files))
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 503, in extend
          self.files.extend(filter(self._safe_path, paths))
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/command/sdist.py", 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/sdist.py", 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/cmd.py", line 306, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 109, in ensure_finalized
          self.finalize_options()
        File "/private/var/folders/yl/9f41bg257qnggbnkdl9fplbxtd5rh5/T/pip-install-216jee17/numpy_b36a0eeedf3f493282d651adbe89947b/numpy/distutils/command/config_compiler.py", line 69, in finalize_options
          v = getattr(c, a)
        File "/opt/homebrew/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 157, in __getattr__
          return _build_ext.build_ext.__getattr__(self, name)
        File "/opt/homebrew/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", 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 (19.1k 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 https://opencarp.org/download/installation#development-installation

If an issue with tables occurs, you likely need to install HDF5 before as described here: https://opencarp.org/q2a/637/during-carputils-installation-installing-python-dependency
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.
 
https://opencarp.org/q2a/786/problem-in-runing-make-on-mac-m1-machine
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 https://pypi.anaconda.org/scipy-wheels-nightly/simple 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
MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], config: ["MMLorHTML.js"], jax: ["input/TeX"], processEscapes: true } }); MathJax.Hub.Config({ "HTML-CSS": { linebreaks: { automatic: true } } });
...