How to connect a PIC32MK 100-pin Motor Control Plug-In Module (PIM) for programming
Carefully check all items of chapter 2, also the very first bullet (which may cause your issue)


  The following is a list of pin names, which must always be connected:
  - All VDD and VSS pins (see 2.2 “Decoupling Capacitors”)


You write you only connected pin 2 and 15. The connection to pins 16&amp;36 you write about only count when you turned on the option the PicKIT is powering the device (which I'd advise against in this case).

Do connect all power pins to the power source and provide a decoupling capacitor as close as possible to each Vdd/Vss pair.