Fix for `no package called pandas` in SlicerMorph ALPACA k-means template selection - Apple ARM

Hi community,

I’ve run into a problem with k-means template selection on 2 different mac machines. One is a 2020 MacBook Pro M1, and the second is a 2023 MacBook Pro M3 Max. Working through the tutorial here, I can run steps 1 & 2, generating the reference point cloud, and generating the point clouds for the rest of my samples that match the reference, without error. Everything looks fine.

When I go to the next step called K-means based template selection, I set my number of templates, my # of iterations, then push the button and nothing happens. Changing the settings doesn’t help. A red stop sign with an error message pops up in the corner. The python console it says:

no package called pandas found

anaconda is built correctly on both computers, and pandas is installed. Error still received.

I found that following the steps outlined in this discourse post from 2019 from @pieper fixes the problem.

Go to the python terminal in Slicer, then:

>>> import os
>>> os.system('PythonSlicer -m pip install pandas')
0
>>> import pandas

(This is @pieper 's work, not mine :slight_smile: )

Restart, and everything works like normal! It took me a while to figure out a fix for this. I am hoping that anyone who has this problem will run across this post.

Cheers!

This is interesting, thanks for sharing.

ALPACA itself doesn’t use Pandas, but it calls GPA module, which uses. But I thought pandas is bundled with core SlicerPython. So you shouldn’t have to manually install it.

So I am not sure why this is happening. Is this a apple silicon specific issue?

I don’t think pandas is bundled with Slicer core. Any module that needs it should pip install it.

Is this a apple silicon specific issue?

In my experience, k-means template selection and all the other SlicerMorph tools have worked out of the box on Windows machines. I found it interesting that no one else has reported this problem. Maybe the k-means selection isn’t commonly on Macs.

I should report that I’m using 3DSlicer 5.6.2, and I installed SlicerMorph on this machine within the past 2 days. The older M1 machine that had this same issue was using the stable 3DSlicer build from January 2024.