Encoders on Waveshare MCP23017 don't work

Your issue comes from the type of encoders boards you’re using.
Workaround here:

I have removed all resistors from the encoders and connected the GND on each encoder to a separate GND on the PI I/O ( pind 6,9,14 and 20)
I’ve just carried out a test with the unmodified encoder I have ( purchased a set of 5 ) and it will not work with the pull up resistors in place.