No, it cannot be avoided. The tax on capital gain is required to be paid irrespective of the residential status of the person.