# Root installation issue

**URL:** <https://root-forum.cern.ch/t/root-installation-issue/59369>\
**Category:** Newbie\
**Tags:** python\
**Created:** [May 17, 2024, 12:40am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369 "2024-05-17T00:40:36Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![redlios](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@redlios](https://root-forum.cern.ch/u/redlios)\
**Post date:** [May 17, 2024, 12:40am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/1 "2024-05-17T00:40:36Z")

</div>

_ROOT Version:_ root\_v6.30.06  
_Platform:_ Windows  
_Compiler:_ Visual Studio Code

* * *

I completed all of the steps to download all of the dependencies and then downloaded the latest version of root. Updated the environment variables to include “thisroot.sh” and “thisroot.bat” (I wasn’t sure which one was right so both were added) , and am able to run “root” in the terminal. However, I cannot import ROOT in my code. I still get the “ModuleNotFoundError”. Could it be a missing python binding? Could someone please help me troubleshoot the problem?

---

<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:** [May 17, 2024, 6:55am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/2 "2024-05-17T06:55:50Z")

</div>

Hi,

Are you able to boot ROOT? How do you get this error?  
@bellenot

Cheers,  
Danilo

---

<div class="post-metadata">

**Author:** ![redlios](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@redlios](https://root-forum.cern.ch/u/redlios)\
**Post date:** [May 17, 2024, 8:14am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/3 "2024-05-17T08:14:00Z")

</div>

Hi,  
Yes, I can run “root” in the terminal. The error arises when I try “import ROOT” with my python script.  
The error is “ModuleNotFoundError: No module named ‘ROOT’”.  
Just for reference about the python version:  
`$root-config --python-version`  
`3.11.7`

`$python`  
`Python 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023,`  
`18:05:47) [MSC v.1916 64 bit (AMD64)] on win32`  
`Type "help", "copyright", "credits" or "license" for more information.`  
So, I think the python version can be ruled out for this issue.

Thanks for the quick reponse

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 17, 2024, 2:09pm UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/4 "2024-05-17T14:09:08Z")

</div>

could you try the following?

```auto
import sys
sys.path.append("C:\yourROOTfolder\lib") # Change path to wherever libcppyy is located in your installation folders
import ROOT

```

---

<div class="post-metadata">

**Author:** ![redlios](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@redlios](https://root-forum.cern.ch/u/redlios)\
**Post date:** [May 17, 2024, 6:55pm UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/5 "2024-05-17T18:55:06Z")

</div>

> [@ferhue](#):
>
> `sys.path.append("C:\yourROOTfolder\lib")`

It worked. Thank you so much.

Is this the only way to get to make the “ROOT” module accessible? And is running `thisroot.bat` supposed to accomplish that?

Thanks again!

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 17, 2024, 8:36pm UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/6 "2024-05-17T20:36:53Z")

</div>

Yeah, thisroot.bat should have achieved that, but somehow it didn’t work either for me and I had to add the path via sys. I do not know why it’s failing. Maybe @bellenot knows.

---

<div class="post-metadata">

**Author:** ![redlios](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@redlios](https://root-forum.cern.ch/u/redlios)\
**Post date:** [May 17, 2024, 9:10pm UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/7 "2024-05-17T21:10:14Z")

</div>

I see I see. Thanks for the fix.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 21, 2024, 6:58am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/8 "2024-05-21T06:58:15Z")

</div>

Weird, on Windows, the Python libraries are supposed to be in the `bin` directory, not in `lib`. I’ll check

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 21, 2024, 7:12am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/9 "2024-05-21T07:12:15Z")

</div>

I cannot reproduce the issue. `thisroot.bat` properly sets the environment variables:

```cmd
C:\Users\bellenot\Downloads\root>bin\thisroot.bat

C:\Users\bellenot\Downloads\root>python
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>>

```

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 21, 2024, 9:49am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/10 "2024-05-21T09:49:41Z")

</div>

Hmm maybe it was because of running from a Powershell instead of a CMD shell.

(The other less likely explanation might be when having multiple Python versions installed in the system, calling C:\Programs\python3.11 might ignore PYTHONPATH. )

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 21, 2024, 10:38am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/11 "2024-05-21T10:38:59Z")

</div>

Right, I’ll investigate

---

<div class="post-metadata">

**Author:** ![g0dmax](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/g0dmax/32/36563_2.png) [@g0dmax](https://root-forum.cern.ch/u/g0dmax)\
**Post date:** [May 21, 2024, 11:04am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/12 "2024-05-21T11:04:39Z")

</div>

Hi I’m having the same issue on VS code.  
I’ve installed everything thats needed and unarchived the root folder. I tried to do the import sys and append method provided above but its still not working. I have the same Root Version, Platform, and Compiler as the original poster of this thread.

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 21, 2024, 12:31pm UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/13 "2024-05-21T12:31:15Z")

</div>

When running with VS code embedded terminal, try switching from “powershell” to “cmd”. I did that and it solved it for me.  
(I called first vcvarsall.bat as it’s done when you start x64 native tools)

---

<div class="post-metadata">

**Author:** ![g0dmax](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/g0dmax/32/36563_2.png) [@g0dmax](https://root-forum.cern.ch/u/g0dmax)\
**Post date:** [May 23, 2024, 12:40am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/14 "2024-05-23T00:40:55Z")

</div>

oh we have to call thisroot.bat first then its able to be imported?

---

<div class="post-metadata">

**Author:** ![redlios](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@redlios](https://root-forum.cern.ch/u/redlios)\
**Post date:** [May 26, 2024, 4:45am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/15 "2024-05-26T04:45:24Z")

</div>

I didn’t append the path through `lib` . I still used `bat`. It is strange however how running the batch file in cmd works but not in powershell. To be honest, I dont really know the difference between them.

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 26, 2024, 9:02am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/16 "2024-05-26T09:02:12Z")

</div>

Probably some of the commands used here: [root/config/thisroot.bat at master · root-project/root · GitHub](https://github.com/root-project/root/blob/master/config/thisroot.bat)  
are not valid for Powershell.

@bellenot would it be possible to provide a thisroot.ps1 script alongside with the thisroot.bat one?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 27, 2024, 8:31am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/17 "2024-05-27T08:31:12Z")

</div>

> [@ferhue](#):
>
> would it be possible to provide a thisroot.ps1 script alongside with the thisroot.bat one?

I guess so. I’ll check

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 27, 2024, 8:12pm UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/18 "2024-05-27T20:12:16Z")

</div>

I just checked the binary distribution and there is already a `thisroot.ps1`

```auto
# Execute this script to set up the ROOT environment variables in Powershell.
#
# Author: Bertrand Bellenot, 17/11/2020

$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$ROOTSYS = split-path -parent (get-item $scriptPath)
$env:PATH = $ROOTSYS + '\bin;' + $env:PATH
$env:CMAKE_PREFIX_PATH = $ROOTSYS + ';' + $env:CMAKE_PREFIX_PATH
$env:PYTHONPATH = $ROOTSYS + '\bin;' + $env:PYTHONPATH
$env:CLING_STANDARD_PCH = "none"

```

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 28, 2024, 6:50am UTC](https://root-forum.cern.ch/t/root-installation-issue/59369/19 "2024-05-28T06:50:33Z")

</div>

Thanks for that info!

I confirm that it works on VS Code now with powershell!

I had no idea, so I opened a PR to update the web documentation.
