How to install pyroot on macOS Catalina (10.15.7)?

This is macOS Catalina (10.15.7) on a Mac Pro. I have used Root for many years, but am just starting with pyroot.

I just installed Root 6.24.02 from the download page. In the Finder I can run “/Applications/root_v6.24.02/bin/root” – it pops up a Terminal window with a Root prompt, and “new TBrowser” works. So Root itself is properly installed.

The documents imply that pyroot is installed with Root. But it isn’t installed for either the default /usr/bin/python (which is out-of-life 2.7.16), or my python3 from HomeBrew.

I have installed python via HomeBrew: “brew install python”, which puts python 3.9.6 into /usr/local/bin, and I use it a lot (without Root). I can do “pip3 install pyroot” which succeeds, but the symbol pyroot.gRoot is not defined:

$ python3
Python 3.9.6 (default, Jun 29 2021, 06:20:32) …
>>> import pyroot
>>> dir(pyroot)
[‘doc’, ‘file’, ‘loader’, ‘name’, ‘package’, ‘path’, ‘spec’]

That is useless so I uninstalled that pyroot.

How do I install pyroot into python3 from HomeBrew? Or any other Python 3 on Mac.
The program to which I’m adding Root requires Python 3.

Also, I can do this:

cd /Applications/root\_v6.24.02/bin root-config --python-version
$ /usr/bin/python
… Python 2.7.16 (default, Mar 25 2021, 03:11:28) …
>>> import ROOT
ImportError: No module named ROOT
>>> import pyroot
ImportError: No module named pyroot

So even though Root claims to have built for Python 2.7.16, it won’t import.

I should have realized this earlier. The way to install Root so it installs into Python3 from HomeBrew is to use HomeBrew to install Root:

brew install root

It now works from the command-line, and Python3: “import ROOT as root”.
(The binary packages of Root that I installed do not conflict; they are not needed.)

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