# ImportError: Failed to import libcppyy3\_8. Please check that ROOT has been built for Python 3.8

**URL:** <https://root-forum.cern.ch/t/importerror-failed-to-import-libcppyy3-8-please-check-that-root-has-been-built-for-python-3-8/58856>\
**Category:** Newbie\
**Tags:** python, root\
**Created:** [April 4, 2024, 8:30pm UTC](https://root-forum.cern.ch/t/importerror-failed-to-import-libcppyy3-8-please-check-that-root-has-been-built-for-python-3-8/58856 "2024-04-04T20:30:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eballabe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eballabe/32/21846_2.png) [@eballabe](https://root-forum.cern.ch/u/eballabe)\
**Post date:** [April 4, 2024, 8:30pm UTC](https://root-forum.cern.ch/t/importerror-failed-to-import-libcppyy3-8-please-check-that-root-has-been-built-for-python-3-8/58856/1 "2024-04-04T20:30:40Z")

</div>

Hi, this is what I get when I try to import ROOT in python 3.8 on my macOS terminal

> python3
> 
> > Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)  
> > [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 “/Applications/root\_v6.30.06/lib/cppyy/ **init**.py”, line 60, in   
> > importlib.import\_module(libcppyy\_mod\_name)  
> > File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/ **init**.py”, line 127, in import\_module  
> > return \_bootstrap.\_gcd\_import(name[level:], package, level)  
> > File “”, line 1014, in \_gcd\_import  
> > File “”, line 991, in \_find\_and\_load  
> > File “”, line 973, in \_find\_and\_load\_unlocked  
> > ModuleNotFoundError: No module named ‘libcppyy3\_8’  
> > During handling of the above exception, another exception occurred:  
> > Traceback (most recent call last):  
> > File “”, line 1, in   
> > File “/Applications/root\_v6.30.06/lib/ROOT/ **init**.py”, line 25, in   
> > import cppyy  
> > File “/Applications/root\_v6.30.06/lib/cppyy/ **init**.py”, line 62, in   
> > raise ImportError(  
> > ImportError: Failed to import libcppyy3\_8. Please check that ROOT has been built for Python 3.8

* * *

_Please read [tips for efficient and successful posting](https://root-forum.cern.ch/t/tips-for-efficient-and-successful-posting/28292) and [posting code](https://root-forum.cern.ch/t/posting-code-read-this-first/28293)_

_Please fill also the fields below. Note that **`root -b -q`** will tell you this info, and starting from 6.28/06 upwards, you can call **`.forum bug`** from the ROOT prompt to pre-populate a topic._

_ROOT Version:6.30.05  
 Platform: MacOS 14.4.1_

---

<div class="post-metadata">

**Author:** ![eballabe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eballabe/32/21846_2.png) [@eballabe](https://root-forum.cern.ch/u/eballabe)\
**Post date:** [April 4, 2024, 8:35pm UTC](https://root-forum.cern.ch/t/importerror-failed-to-import-libcppyy3-8-please-check-that-root-has-been-built-for-python-3-8/58856/2 "2024-04-04T20:35:57Z")

</div>

This is what I get in python 3.12.2

> import ROOT
> 
> > /Applications/root\_v6.30.06/lib/cppyy/ **init**.py:72: SyntaxWarning: invalid escape sequence ‘\d’  
> > if re.match(‘^libcppyy\_backend\d+\_\d+$’, lib\_name):  
> > Traceback (most recent call last):  
> > File “/Applications/root\_v6.30.06/lib/cppyy/ **init**.py”, line 60, in   
> > importlib.import\_module(libcppyy\_mod\_name)  
> > File “/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/ **init**.py”, line 90, in import\_module  
> > return \_bootstrap.\_gcd\_import(name[level:], package, level)  
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
> > File “”, line 1387, in \_gcd\_import  
> > File “”, line 1360, in \_find\_and\_load  
> > File “”, line 1324, in \_find\_and\_load\_unlocked  
> > ModuleNotFoundError: No module named ‘libcppyy3\_12’  
> > During handling of the above exception, another exception occurred:  
> > Traceback (most recent call last):  
> > File “”, line 1, in   
> > File “/Applications/root\_v6.30.06/lib/ROOT/ **init**.py”, line 25, in   
> > import cppyy  
> > File “/Applications/root\_v6.30.06/lib/cppyy/ **init**.py”, line 62, in   
> > raise ImportError(  
> > ImportError: Failed to import libcppyy3\_12. Please check that ROOT has been built for Python 3.12

---

<div class="post-metadata">

**Author:** ![eballabe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eballabe/32/21846_2.png) [@eballabe](https://root-forum.cern.ch/u/eballabe)\
**Post date:** [April 4, 2024, 10:50pm UTC](https://root-forum.cern.ch/t/importerror-failed-to-import-libcppyy3-8-please-check-that-root-has-been-built-for-python-3-8/58856/3 "2024-04-04T22:50:59Z")

</div>

solved by

> pip install cppyy

as suggested by chatGPT

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [April 5, 2024, 7:01am UTC](https://root-forum.cern.ch/t/importerror-failed-to-import-libcppyy3-8-please-check-that-root-has-been-built-for-python-3-8/58856/4 "2024-04-05T07:01:25Z")

</div>

Hi Eric,

Glad the mix works (maybe [Xrootd with TChain - #2 by Danilo](https://root-forum.cern.ch/t/xrootd-with-tchain/58862/2)). How did you install ROOT?

Cheers,  
D

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 19, 2024, 7:01am UTC](https://root-forum.cern.ch/t/importerror-failed-to-import-libcppyy3-8-please-check-that-root-has-been-built-for-python-3-8/58856/5 "2024-04-19T07:01:56Z")

</div>

Closed on April 19, 2024, 7:01am UTC

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