ROOT is installed but . bin/thisroot.sh is not working

I have Windows 10 64 bit and Python 3.7.9 installed with Anaconda3. I have both VS2015 and VS2019 installed so I did a source build from GitHub so I could verify I was building against the proper versions of VS and python. Everything is installed. I have tried to run

. bin/thisroot.sh

but I get the error

‘.’ is not recognized as an internal or external command,
operable program or batch file.

I have also tried

source ./thisroot.sh

which gives an error

‘source’ is not recognized as an internal or external command,
operable program or batch file.

I have tried

C:\Users\Kat\root_build>PATH = . bin/thisroot.sh

which runs, but I am not sure if this does what I want, and despite this last line I still cannot open root. Any help is VERY much appreciated! Thank you!


I don’t use Anaconda, so I don’t know if it is different, but sh scripts are for Linux, not Windows. Try just adding the “bin” path (maybe “C:\Users\Kat\root_build\bin”?) to your Windows path environment variable, either for the user or for the system.

Use C:\Users\Kat\root_build\bin\thisroot.bat

Ok! Thank you! I had added the root installation dir to my Windows environmental variables, so let me try this instead!

I am definitely new and trying to learn to please bare with me. I tried

(base) C:\Users\Kat\root_build>PATH = C:\Users\Kat\root_build\bin\thisroot.bat

which runs. I also tried setting the Windows environmental variables to variations of what was suggested above, but root is not recognized when I try to open it. When I do

C:\Users\Kat> dir

I see root and root_build. Neither of these appear when I search for installed conda packages (I was under the impression that ROOT installed as a package since I will be importing it into Python, please let me know if I am wrong). When I check environmental variables I have ROOTSYS set to my root installation dir (ROOTSYS=root). I tried to set
conda env export ROOTSYS= C:\Users\Kat\root_build\bin\thisroot.bat

but that gives an error that ROOTSYS= C:\Users\Kat\root_build\bin\thisroot.bat.

Thank you all in advance for your help!

It’s not what I showed. You can either type, in the command prompt:

C:\Users\Kat>root_build\bin\thisroot.bat

Or manually set the environment variables (still in the command prompt):

C:\Users\Kat>set ROOTSYS=C:\Users\Kat\root_build
C:\Users\Kat>set PATH=%ROOTSYS%\bin;%PATH%

Then you should be able to start ROOT:

C:\Users\Kat>root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.25/01                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win32 on Apr 22 2021, 14:16:01                         |
  | From heads/master@v6-25-01-712-gd05c6236c5                       |
  | With MSVC 19.24.28319.0                                          |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0]

Thank you for being explicit! I followed what you did exactly, and I can’t open root from my Anaconda prompt, but when I try in Spyder 5 I get

[1] import ROOT
Traceback (most recent call last):

File “C:\Users\Kat\root_build\bin\cppyy_init_.py”, line 60, in
importlib.import_module(libcppyy_mod_name)

File “C:\Users\Kat\anaconda3\lib\importlib_init_.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)

File “”, line 1006, in _gcd_import

File “”, line 983, in _find_and_load

File “”, line 965, in _find_and_load_unlocked

ModuleNotFoundError: No module named ‘libcppyy3_7’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “”, line 1, in
import ROOT

File “C:\Users\Kat\root_build\bin\ROOT_init_.py”, line 22, in
import cppyy

File “C:\Users\Kat\root_build\bin\cppyy_init_.py”, line 64, in
libcppyy_mod_name, major, minor))

ImportError: Failed to import libcppyy3_7. Please check that ROOT has been built for Python 3.7

At least Python is finding ROOT!

OK, sorry, I have no experience with Anaconda or Spyder and can’t help with that. Can you try from a regular Command Prompt, or even better from a x86 Native Tools Command Prompt for VS 2019 (from the Visual Studio 2019 entry of the Windows start menu)?

Hmm. I definitely could try both of those! Thank you.