Problems with alpaca

Hello, this is my first time using 3d slicer. I write to community 'cause I have had some problem with ALPACA, it does not run . The phyton console showes this:

In the future np.bool will be defined as the corresponding NumPy scalar.
Traceback (most recent call last):
File “C:/Users/USUARIO/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/SlicerMorph/lib/Slicer-5.8/qt-scripted-modules/ALPACA.py”, line 105, in setup
from itk import Fpfh
File “C:\Users\USUARIO\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\itk_init_.py”, line 59, in
from itk.support.extras import *
File “C:\Users\USUARIO\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\itk\support\extras.py”, line 37, in
import itk.support.types as itkt
File “C:\Users\USUARIO\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\itk\support\types.py”, line 178, in
) = itkCType.initialize_c_types_once()
File “C:\Users\USUARIO\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\itk\support\types.py”, line 143, in initialize_c_types_once
B: “itkCType” = itkCType(“bool”, “B”, np.dtype(np.bool))
File "C:\Users\USUARIO\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\numpy_init
.py", line 353, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module ‘numpy’ has no attribute ‘bool’.
np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
NumPy 1.20.0 Release Notes — NumPy v2.4.dev0 Manual

I hope someone could help me, I would be very grateful

please see the workaround in this thread:

Thenks a lot for your answer. I have installed numpy as you said, but a new error has appeared, it says: “AttributeError: np.Inf was removed in the NumPy 2.0 release. Use np.inf instead.”

FYI @smrolfe

I would suggest adding the ruff hook to SlicerMorph’s pre-commit-config like in Slicer as ruff includes a numpy 2 deprecation rule that can auto apply fixes ( numpy2-deprecation (NPY201) | Ruff).

2 Likes

Thanks @jamesobutler

When is Slicer going to officially transition to numpy 2?

Slicer preview already comes with numpy 2 bundled. This was updated as part of the transition to Python 3.12. Most latest Python packages have numpy binary compatibility with numpy 1 and 2.

1 Like

Muchas gracias por tu repsuesta, el problema fue solucionado. Ten un maravilloso día. :raising_hands: