For the MCP23017 28-pin DIP package make sure you have connections to:
RESETn (pin 18)
A2, A1, A0 (pins 17, 16, 15) - these should be pulled low (GND) for address $40... they should not be left floating

There should also be pullups to VDD on SCL (pin 12) and SDA (pin 13)