Hi! I downloaded the binary built of root (6.24/00) for Microsoft Visual Studio 2019, then I installed it normally and set it to PATH.
I tried to import root in a code on VS 2019 but it did not work. Is there an additional step that I have to take before using it on VS?
Welcome to the ROOT Forum!
I’m not sure I understand what you mean. Can you give more details? What did you try exactly?
Sorry. I have a python 2 code that my professor wants me to use for some charts that we need. The code needs to import root but it is not working.
I think root is not added on VS.
The 4th step of installation says " 4. Add the ROOT libraries and executables to your environment by sourcing the appropriate thisroot.*
script. These setup scripts can be found in the ROOT binary release, in the bin
directory.", but I do not know how to do that.
OK, so now I’m confused. If you want to use ROOT from Python, here is what I would suggest:
Open a x86 Native Tools Command Prompt for VS 2019
, go (cd) to the directory where your code is located, call (type) C:\root\bin\thisroot.bat
(if you installed ROOT in C:\root\
), then start Python and you can import ROOT.
And I still don’t understand this sentence:
If you want root.exe
to be known by Visual Studio, you have to add C:\root\bin\
in the PATH of Visual Studio, but I’m not sure why you would need that…
I only mean I want to be able to use it on VS.
I did what you said and VS still shows the same warning (unresolved import ‘ROOT’). What should I do?
In your Windows settings, add a ROOTSYS
environment variable pointing to where you installed ROOT (e.g. C:\root
), add %ROOTSYS%\bin
in your PATH
and in PYTHONPATH
(create it if it doesn’t exist). Then re-start VS
I did everything you said, but the warning remains.
Can you check if I did it right?
Yes, it looks OK. Can you describe exactly (step by step) what you do and what is the exact warning you got?
My professor told me I can use his computer. So I do not have to install it anymore.
Thank you for your help and sorry for the trouble. Should I tag it as solved?
Glad to see you can use it, and no problem, don’t worry!
And no need to mark it as solved