An unexpected error occurred: ModuleNotFoundError: No module named ‘CloudFlare’
That error means NPM is trying to use the Cloudflare DNS challenge plugin (Certbot / lego) but the Python CloudFlare module it expects isn’t available (or the wrong Cloudflare library got installed). This is a known break that shows up with some NPM versions when using the Cloudflare DNS provider. GitHub+2Git Memory+2
The quick fix (works for most people)
Exec into the NPM container and pin the Cloudflare Python package to a compatible 2.x version:
docker exec -it nginx-proxy-manager bash
pip install --upgrade "cloudflare==2.19.*"
exit
docker restart nginx-proxy-manager
This “pins” the Cloudflare library version that matches what the certbot Cloudflare DNS plugin expects, avoiding the ModuleNotFoundError: No module named 'CloudFlare' failure. Git Memory+1
If you still get the error
A) Install the certbot Cloudflare plugin inside the container (if missing)
Some environments fail because the DNS plugin itself isn’t present/loaded correctly:
docker exec -it nginx-proxy-manager bash
pip install --upgrade certbot-dns-cloudflare
exit
docker restart nginx-proxy-manager
(Then try issuing/renewing the cert again.) DeepWiki+1
B) Avoid container changes resetting after updates
If you update NPM later, that pip install may be lost (because containers are immutable). Two better options:
-
Use an NPM image/tag where this is already fixed (preferred for long-term stability). Watch/track the upstream issue and release notes. GitHub+1
-
Build a custom image extending NPM and adding the pinned dependency (more work, but permanent).
Why this happens (in plain English)
Cloudflare has multiple Python packages with confusing names (and major version changes). Some NPM/certbot combinations expect an older import/module layout (CloudFlare / cloudflare-python style), and when a newer library is present, certbot can throw exactly the error you’re seeing. Git Memory+2PyPI+2
After fixing it, renew again
In the NPM UI: SSL Certificates → Renew (or re-issue the cert).