Error in installing ROOT in conda environment for python 2.7: Failed to import libcppyy*

ROOT Version: 6.22.0
Platform: Mac 11.4


Sorry if I am not expressing myself in the correct jargon, but I am fairly new with these topics.

I have ROOT already running on my local machine, now I am working inside an Anaconda environment with Python 2.7. When setting up the environment I directly installed ROOT version 6.22 (compatible with Python 2.7) - it is also listed with
conda list root

However when wanting to import ROOT inside python, I am getting the following error message:

“Traceback (most recent call last):
File “”, line 1, in
File “/Users/FranzkeMM/root_v6.26.00/lib/ROOT/”, line 22, in
import cppyy
File “/Users/FranzkeMM/root_v6.26.00/lib/cppyy/”, line 64, in
libcppyy_mod_name, major, minor))
ImportError: Failed to import libcppyy2_7. Please check that ROOT has been built for Python 2.7”

so it seems, that python somehow looks for root on the version that is locally installed and not via Anaconda.

So my idea would have been to prevent this with sourcing like this:

source ~/opt/anaconda3/pkgs/root-binaries-6.22.0-py27hdf2d85e_2/bin/

But the message is being returned:
" ERROR:, thisroot.csh and should never be used

Look at using “conda activate ENVIRONMENT_NAME”

Any ideas on what is happening? Thanks a lot in advance!

P.S. when sourcing to the file of the locally installed root, it is working, but this is in general not what I want of course

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

Hi @mike_f ,

welcome to the ROOT forum and sorry for the lack of replies, this must have slipped through the cracks!

I am not sure I understand the situation, are you mixing conda environments and non-conda installations of ROOT? That is not supported.

If you make sure you have no ROOT installation available in your environment (e.g. no source in your .bashrc) and then install ROOT as a conda package, that should work.
You can also try to completely remove the local installation so that it cannot interfere with the conda installation.

On Mac you can also install ROOT via homebrew.

I hope this helps,

This topic was automatically closed after 10 days. New replies are no longer allowed.