[CEA 48169] Windows + Numba: cppyy.sizeof('void*') Issue?


ROOT Version: 6.36.06
Platform: win64
Compiler: 19.39.33521.0


Hello,

I want to test your RDataFrame example on Windows: ROOT: ROOT::RDataFrame Class Reference
Python interface / User code in the RDataFrame workflow / Python code:

@ROOT.Numba.Declare(["float"], "bool")
def myFilter(x):
    return x > 10
 
df = ROOT.RDataFrame("myTree", "myFile.root")
sum = df.Filter("Numba::myFilter(x)").Sum("y")
print(sum.GetValue())

Prerequisites

ROOT

I installed your binary package for Windows: https://root.cern/download/root_v6.36.06.win64.python311.vc17.zip

PS C:\Users\...\48169\roottest> . C:\Users\...\48138\downloads\root_v6.36.06.win64.python311.vc17\root\bin\thisroot.ps1
PS C:\Users\...\48169\roottest> root -q
   ------------------------------------------------------------------
  | Welcome to ROOT 6.36.06                        https://root.cern |
  | (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win64 on Nov 25 2025, 11:53:37                         |
  | From tags/v6-36-06@v6-36-06                                      |
  | With MSVC 19.39.33521.0                                          |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

Python

Then I created a virtual environment:

PS C:\Users\...\48169\roottest> root-config --python-version
3.11.7
PS C:\Users\...\48169\roottest> py -3.11 -m venv numba
PS C:\Users\...\48169\roottest> & .\numba\Scripts\Activate.ps1
(numba) PS C:\Users\...\48169\roottest> py -3.11 -m pip install numba cffi
Collecting numba
  Using cached numba-0.62.1-cp311-cp311-win_amd64.whl.metadata (2.9 kB)
Requirement already satisfied: cffi in c:\users\...\appdata\local\programs\python\python311\lib\site-packages (2.0.0)
Collecting llvmlite<0.46,>=0.45.0dev0 (from numba)
  Using cached llvmlite-0.45.1-cp311-cp311-win_amd64.whl.metadata (5.0 kB)
Collecting numpy<2.4,>=1.22 (from numba)
  Using cached numpy-2.3.5-cp311-cp311-win_amd64.whl.metadata (60 kB)
Requirement already satisfied: pycparser in c:\users\...\appdata\local\programs\python\python311\lib\site-packages (from cffi) (2.23)
Using cached numba-0.62.1-cp311-cp311-win_amd64.whl (2.7 MB)
Using cached llvmlite-0.45.1-cp311-cp311-win_amd64.whl (38.1 MB)
Using cached numpy-2.3.5-cp311-cp311-win_amd64.whl (13.1 MB)
Installing collected packages: numpy, llvmlite, numba
  WARNING: The scripts f2py.exe and numpy-config.exe are installed in 'C:\Users\...\AppData\Local\Programs\Python\Python311\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed llvmlite-0.45.1 numba-0.62.1 numpy-2.3.5

[notice] A new release of pip is available: 24.0 -> 25.3
[notice] To update, run: C:\Users\...\AppData\Local\Programs\Python\Python311\python.exe -m pip install --upgrade pip
(numba) PS C:\Users\...\48169\roottest>

Test

Script

Here is a minimal script: uranie/cea/python/filter.py · 65b3ff9b7e2d9632c1b01d2b2e87f9da82fa84f5 · Uranie CEA / ROOT / roottest · GitLab

import ROOT
import cppyy
import ctypes

print('c_void_p:', ctypes.sizeof(ctypes.c_void_p))
print('void*:', cppyy.sizeof('void*'))

@ROOT.Numba.Declare(["float"], "bool")
def myFilter(x):
    return x > 10

Result

Finally I got:

(numba) PS C:\Users\...\48169\roottest> py -3.11 .\uranie\cea\python\filter.py
c_void_p: 8
void*: None
Traceback (most recent call last):
  File "C:\Users\...\48169\roottest\uranie\cea\python\filter.py", line 8, in <module>
    @ROOT.Numba.Declare(["float"], "bool")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\48138\downloads\root_v6.36.06.win64.python311.vc17\root\bin\ROOT\_numbadeclare.py", line 38, in _NumbaDeclareDecorator
    import cppyy.numba_ext
  File "C:\Users\...\48138\downloads\root_v6.36.06.win64.python311.vc17\root\bin\cppyy\numba_ext.py", line 35, in <module>
    ir_intptr_t = ir.IntType(cppyy.sizeof('void*')*8)
                             ~~~~~~~~~~~~~~~~~~~~~^~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
(numba) PS C:\Users\...\48169\roottest>

Discussion

Best regards,

Got the same results, but I don’t know if it’s Windows specific… Maybe @vpadulan can take a look and tell us more