How to install root with pyroot in apple m1?

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.24.06
Platform: macos BigSur M1

Hi guys,
i’m trying to compile root for apple m1 including pyroot libraries.

what i do is this.

git clone --branch v6-24-06 root-src  
mkdir root-build root-install && cd root-build    
cmake -DCMAKE_INSTALL_PREFIX=../root-install  -Dbuiltin_tbb=OFF -Dimt=OFF -DPYTHON3_EXECUTABLE=/usr/local/bin/python3 ../root-src | tee build.txt
cmake --build . -- install -j6 | tee install.txt 

when I finished the compilation I run python3 and do the import of the ROOT library

but it outputs this

roany@Air-di-Roany root-build % python3
Python 3.8.9 (v3.8.9:a743f8192b, Apr  2 2021, 08:12:53) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
  File "/Users/roany/root-install/lib/cppyy/", line 60, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 556, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1101, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: dlopen(/Users/roany/root-install/lib/, 2): no suitable image found.  Did find:
	/Users/roany/root-install/lib/ mach-o, but wrong architecture
	/Users/roany/root-install/lib/ mach-o, but wrong architecture
	/Users/roany/root-install/lib/ mach-o, but wrong architecture
	/Users/roany/root-install/lib/ mach-o, but wrong architecture

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/roany/root-install/lib/ROOT/", line 22, in <module>
    import cppyy
  File "/Users/roany/root-install/lib/cppyy/", line 62, in <module>
    raise ImportError(
ImportError: Failed to import libcppyy3_8. Please check that ROOT has been built for Python 3.8

what am i doing wrong?
the build log file:
build.txt (14.7 KB)

the install log file:
install.txt (1.2 MB)

In your build.txt file I can see:

-- Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found version "3.8.9")

I guess that’s the origin of the problem.

thx for reply
how to operate in this case?

As it seems to be a python issue may be @etejedor will know.

thanks for the reply, i am reinstalling python and try to compile root but it doesn’t work import ROOT


I understand you built PyROOT in the same machine where you are using it? I’m asking because of the mach-o, but wrong architecture error.

A quick search online suggests this could be an error related with Rosetta configuration:

Alternatively you can try to install ROOT with conda, instead of building from sources, and see if that helps:

yes, its same machine

What @etejedor says still applies: python3 uses a Rosetta architecture different from the build one. You can check the output of cmake; it tells you which architecture it uses. It might just be that your cmake or python3 binaries are of the wrong architecture; you can check with file $(which cmake) and file $(which python3).

Hi friends, I wanted to tell you that everything is working now.

What did I do to install it?

if you have a version of Conda not for Apple Silicon, please delete all.
(many python version there are)
delete all homebrew installation for delete all file not compatible with new conda for arm64.
use: where homebrew and delete

I downloaded the version of CONDA for arm64 directly from here: 
the file is:

( for newbie install with sh ./

After that I followed as reported:
       in this link

$ conda config --set channel_priority strict
$ conda create -c conda-forge --name <my-environment> root
$ conda activate <my-environment>

for example:

conda config --set channel_priority strict
conda create -c conda-forge --name env1 root
conda activate env1

With enviroment conda actived

in python3 prompt

import ROOT
now work fine, without error.

Python 3.10 is installed with conda.
Thanks for support

Wonderful, thanks for reporting this!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.