Error in PicketFence module after updates


I recently updated Python and Pylinac to 3.8.1 and 3.0.1, respectively. After the update I get the following error for every run of this module, including the demo run:

Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 226, in run_demo
pf.analyze(tolerance, action_tolerance=action_tolerance)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 298, in analyze
self.pickets = PicketManager(self.image, self.settings, num_pickets)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 608, in init
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 640, in find_pickets
self.pickets.append(Picket(self.image, self.settings, peak_idx, peak_spacing/2))
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 683, in init
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 690, in _get_mlc_positions
mlc_position = self.find_mlc_peak(mlc_center)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 704, in find_mlc_peak
pix_vals = np.median(self.picket_array[:, mlc_rows], axis=1)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\”, line 740, in picket_array
top_edge = int(self.approximate_idx - self.spacing)
TypeError: only size-1 arrays can be converted to Python scalars

Does anyone have an insight regarding this error?

Thanks in advance,



is there a special reason you did not upgrade to Python 3.8.12 and Pylinac 3.1.0?
When upgrading did you also upgrade all dependencies?


Hi Thomas,

Thanks for your input. During my first contact with Pylinac a year ago, the warning below from installation page motivated me to start with Python 2. I see now my interpretation was wrong…

“Python(x,y) is not yet available for Python 3, so don’t choose this to try running pylinac.”

I dedicated extra time to the code and realized I had mixed uncompatible parts of from my old (and modified) version of Pylinac with the current release code. Now I’m running Python 3.9 with the latest pylinac version smoothly. So, no compatibility issues betweeen python version and pylinac version, it was jut my bad.

Best regards,