When running msPIP function there is a point where the error mentioned in the title occurs.
I was wondering if the following is a valid solution:
nlandmarks <- min(50,nrow(landmarklcms))
# 50 because is the default of nlandmarks in the msPIP function
The idea is to select the whole set of landmarks available in case that they are less than 50 to find the maximum number of nearest neighbors.