Ignorance can be unavoidable and can be avoidable. Unavoidable ignorance is of those who have to access to knowledge like those who live and die in far away forests or remote areas with out any access to learning or asking knowledgeable persons. Unavoidable ignorance is not entitled to punishment because it was imposed on the ignorant and he had no choice.
Avoidable ignorance is a result of laziness or not caring to gain knowledge. Such ignorance is not pardoned. The narration states that sinful person will told on the Day of Judgement : Why did you fail to do good? He replies: I did not know. He will told: Why did you fail to learn? Then he will be punished.
'This means that gaining compulsory knowledge is also compulsory and those who were able to gain it,byte they opt to ignore or don't care for gaining the compulsory knowledge are responsible about their ignorance, unlike those ignorant who had no access at all to knowledge.