DLL load failed

Fix sqlite3 DLL load failed on Windows Python

Python can't find the sqlite3 DLL on Windows. Usually missing VC++ redistributable or a path issue. Here's the fix.

Quick answer

Install the latest Microsoft Visual C++ Redistributable (x64 and x86) and restart your command prompt. That fixes 9 out of 10 cases.

Why this happens

Python's sqlite3 module is a wrapper around the SQLite C library. On Windows, that library ships as a DLL (sqlite3.dll) that Python loads at runtime. If Windows can't find the DLL, you get that cryptic DLL load failed error. The usual culprit is a missing or outdated Visual C++ Redistributable, because SQLite's DLL depends on the VC++ runtime. I've seen this on fresh Windows installs and on machines where someone cleaned out system files with a junk cleaner. One client last month got it after a Windows update reset some PATH variables. Annoying, but fixable.

Fix steps

  1. Install the VC++ Redistributables. Go to Microsoft's official download page and grab both vc_redist.x64.exe and vc_redist.x86.exe. Run both, even if you're on 64-bit. Python can be 32-bit even on 64-bit Windows. Restart your terminal after.
  2. Check your Python architecture. Run python -c "import platform; print(platform.architecture())" in your command prompt. If it says 32bit, you need the x86 redistributable. If it says 64bit, the x64 one. But install both anyway—cheap insurance.
  3. Verify the sqlite3 module. Open a fresh terminal and run python -c "import sqlite3; print(sqlite3.sqlite_version)". If it prints a version like 3.45.1, you're good. If it throws the same error, move on.
  4. Check if you have multiple Python installations. Run where python in the command prompt. If you see more than one path, you might be running a different Python than the one where you installed packages. Use the full path to the Python you want, or set the PATH correctly.
  5. Reinstall Python. Sometimes the DLL gets corrupted or missing during an update. Uninstall Python completely, reboot, then install the latest version from python.org. Make sure to check "Add Python to PATH" during install.

Alternative fixes

If the main fix doesn't work, try these:

  • Copy sqlite3.dll manually. Download the SQLite DLL from sqlite.org (the "sqlite-dll-win64-x64" if you're 64-bit, "win32" if 32-bit). Put the sqlite3.dll file in the same folder as your Python executable, or in C:\Windows\System32 (for 64-bit) or C:\Windows\SysWOW64 (for 32-bit). This is a hack, but it works in a pinch.
  • Use a virtual environment. Create a fresh venv: python -m venv myenv, then activate it and test. Sometimes the system Python is messed up but a venv uses its own copy.
  • Check for antivirus interference. Some AV software quarantines the DLL because it's a legitimate but uncommon file. Add an exception for your Python folder and the DLL.

Prevention tips

Keep the VC++ redistributables updated. Microsoft pushes them via Windows Update, but sometimes they lag. Also, don't delete anything from C:\Windows\System32—I know it looks like junk, but that's where the DLLs live. If you're a developer, use a virtual environment for each project. That isolates you from system-level issues. And if you're on a work computer, ask IT before running anything—had a guy get locked out of his machine once because he tried to fix this himself and broke his PATH. Good luck.

Related Errors in Programming & Dev Tools
0X00010002 0X00010002 Debugger Continued – Why It Happens and the Real Fix ModuleNotFoundError Fix Python ModuleNotFoundError: No module named Unknown host 'd29vzk4ow07wi7.cloudfront.net' Android Studio Gradle Sync: Unknown Host d29vzk4ow07wi7.cloudfront.net NODE_MODULE_VERSION mismatch Fix NODE_MODULE_VERSION mismatch in Node.js native modules

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.