PyROOT on Windows

Hi,

After a long time of not trying, I downloaded the MSVC 2022 binaries to my laptop, to see what’s what. And I’m very pleased with how easily I could make it work. For instance, I didn’t even need to bother with starting a “development terminal”, I am able to do the following in a command prompt right away:

I was also able to open windows, and in general, the interactive session seems to work well. Kudos to you guys! :smile:

Now I thought that I might as well be greedy, and see if I could also make PyROOT work. :imp: I installed Python 3.12 out of the Microsoft Store, I pip-installed numpy on top of it, but I can’t make PyROOT load. :confused:

Microsoft Windows [Version 10.0.22631.4317]
(c) Microsoft Corporation. All rights reserved.

C:\Users\krasz>software\hep\root-6.32.06\bin\thisroot.bat

C:\Users\krasz>python
Python 3.12.7 (tags/v3.12.7:0b05ead, Oct  1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import ROOT
Fatal in <TROOT::InitInterpreter>: cannot load library The specified module could not be found.


C:\Users\krasz>

(I only put “import numpy” there to show that it’s indeed available.)

How could I figure out in more detail what the issue is? I can easily believe that the version of Python that I would’ve installed like this may not be compatible with my downloaded ROOT binaries. But I’m not sure what other version to install instead. :thinking:

So, is this meant to work at all? And if so, how could I make it work on my own machine? :smile:

Cheers,
Attila


ROOT Version: 6.32.06
Platform: Win32
Compiler: MSVC 19.39.33521.0


Hi Attila, try root-config --python-version :wink:

C:\Users\krasz>root-config --python-version
 3.11.7

C:\Users\krasz>

:smile: Let’s see how to install that version then…

AFAICS, you can also install the latest 3.11:

C:\root-dev\temp>root-config --python-version
 3.11.7

C:\root-dev\temp>python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>>

And don’t install it in a directory containing spaces in its PATH (I usually install it in C:\Python311)

Unfortunately it still doesn’t work. :cry:

I even started a terminal with all of the VS2022 stuff set up, in case that may be needed for PyROOT. :thinking: Any way to get a more verbose error message that would hint in more detail at what’s going wrong?

Cheers,
Attila

So, installing it simply through the Microsoft Store is a no go then? :slightly_frowning_face:

Don’t start from a location containing spaces in the PATH (this is a general comment, ROOT doesn’t like spaces in any PATH)

As I said, try to install Python in a location without spaces in the PATH

Hi,

I had to do a bit of cleanup. It turned out that I had an installation of Python 3.9 in my home directory, while also adding 3.12 and then 3.11 using Microsoft Store this morning.

So I:

  • Removed all Python installations that I could find;
  • Installed 3.11.9 using the installer from: Python Releases for Windows | Python.org
    • I installed the thing under C:\Users\krasz\software\python\3.11.9, just because this is how I like to install stuff on my laptop under Linux as well… :thinking:

In this setup PyROOT seems to work finally! :tada:

Thanks for the pointers @bellenot! :smile:

Attila

1 Like

Glad to see you managed to do it! And you’re very welcome!

Fyi, it also works from a PowerShell, or from the embedded terminal in Visual Studio IDE, but in that case you need to call thisroot.ps

1 Like

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