It is difficult to live a moral life in an immoral world. It is difficult to live a chaste life in an unchaste world. It is difficult to live a selfless life in a selfish world. It is difficult to live a peaceful life in a world of violence and false peace. This unloving and unmerciful world cannot teach you how to live a loving and merciful life. This unbelieving world cannot teach you how to live a life of faith in God. Only Christ can teach you the path to live a moral life, a life of grace. He does so through the teachings of Sacred Tradition, Sacred Scripture, and the Magisterium. He does so through the life of worship of the Church.
No matter how well you understand moral theology, no matter how adept you are at distinguishing moral acts from immoral acts, you will not be able to avoid sin unless you are cooperating with grace in the practice of all the virtues. Only light can dispel darkness. Only virtue can overcome vice. Only holiness can vanquish sin. Only by living a life of grace, a life filled with the love of God and neighbor, a life of prayer, self-denial, works of mercy, only in this way — which is truly the Way of Christ — can we avoid evil, and do good. The only moral life is a life filled with grace, love, virtue, prayer, self-denial, mercy. If you find yourself unable to remove sin from your life, it is because you are not cooperating with grace in acts of prayer, self-denial, works of mercy, in acts of love, faith, hope, and all the virtues.
“an immaculate life is a generation of sages.” (Wisdom 4:9).
An immaculate life is a life of greater wisdom than an entire generation of sages. The truest form of wisdom is found in living a life in imitation of Christ. The truly immaculate life is a life which is both lacking in sinful deeds, and filled with virtuous deeds. The Virgin Mary is Immaculate, not only because she was always free from all sin, but also because she filled her life with good works, works of prayer, self-denial, mercy, in full cooperation with every grace, and in the full exercise of every virtue. Spiritual purity consists in avoiding sin, and in doing good, out of love for God and neighbor, in harmony with the will of God. Cooperation with grace brings forth every virtue and every good work. The path of cooperation with grace leads us, in the end, to a life of eternal grace with God.
Whoever does not cooperate with grace, does not love God. Whoever does not love God, cannot avoid committing many sins. Catholic moral theology often focuses on sin, on determining which acts are immoral. But the mere knowledge that an act is immoral is not sufficient for us to be able to avoid that sin. We must cooperate with grace by practicing the virtues. A life of grace is a life of virtue. The practice of any virtue is the practice of every virtue. All the virtues are closely related; each virtue supports and complements every other virtue. No virtue is ever in conflict with any other virtue. All the virtues work together, in grace, to accomplish the will of God.
— The above text is from the beginning of chapter 30 of my book: The Catechism of Catholic Ethics