This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: sqlite3 import * ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
Type: behavior Stage: resolved
Components: Installation, Windows Versions: Python 3.9
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ZenSkunkworx, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-02-11 20:23 by ZenSkunkworx, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg386832 - (view) Author: Tyler Reed (ZenSkunkworx) Date: 2021-02-11 20:23
Running on a new, updated Windows 10 machine with no virtual environment. After removing all previous Python installations, rebooting and performing a fresh install if Python 3.9.1. I run the python console and type:
import sqlite3

I receive the following error:
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python39\lib\sqlite3\", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "C:\Program Files\Python39\lib\sqlite3\", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.

I verified that the sqlite3.dll file does exist in C:\Program Files\Python39\DLLs
msg386833 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2021-02-11 20:30
That looks more like `_sqlite3.pyd` is missing.  You're sure no changes have been to the installation directory?  Does repairing the installation help at all?

I imagine we would have been flooded with issue reports if the installer was missing this module, so without that it does seem that something fishy is going on in your particular case.
msg386835 - (view) Author: Tyler Reed (ZenSkunkworx) Date: 2021-02-11 20:55
It was an environment issue. There were pre-existing files (pyd and pyc) in the application folder (from builds done with Kivy) and apparently python was loading those instead of the libraries in the python39 folder.
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87367
2021-02-11 20:55:17ZenSkunkworxsetstatus: open -> closed
resolution: not a bug
messages: + msg386835

stage: resolved
2021-02-11 20:30:58zach.waresetnosy: + tim.golden, steve.dower, zach.ware, paul.moore
messages: + msg386833

components: + Installation, Windows
type: crash -> behavior
2021-02-11 20:23:58ZenSkunkworxcreate