-3

There is a transitive dependency of Pandas on sqlite3 via SqlAlchemy. Hence, if you don't have sqlite3 installed on Linux or Windows, Pandas won't run. It will show this error.

ModuleNotFoundError: No module named ‘_sqlite3’

Since I don't need SQLite3 in my project, want to run / use Pandas without SQLite3 ?

2
  • 1
    Sqlite3 comes with standard python, why do you uninstall it? Commented Aug 19, 2024 at 10:03
  • How are you using Pandas without having Python installed? And if you have Python installed, how do you not have sqlite3? Surely you catch my drift. Commented Aug 19, 2024 at 10:33

1 Answer 1

1

To bypass sqlite3 if you don't need it with Pandas, write below code in a file named _sqlite3.py and save it in site-packages folder of your virtual environment or python installation.

# _sqlite3.py

version = "3.1"
sqlite_version = "3.1"

class Row:
    pass

def register_adapter(a,b):
    pass

def register_converter(a,b):
    pass

class Connection():
    pass

Tested on Arch Linux and Python 3.8

Note: This might work not just Pandas but for other libraries as well where Sqlite3 is a dependency and you don't have it installed.

Sign up to request clarification or add additional context in comments.

3 Comments

Again, sqlite3 is part of Python. This makes no sense.
@BarrythePlatipus Python does not ship with sqlite3. For instance on Linux, both the Linux sqlite3-lib (the actual lib) and python sqlite3 (the wrapper) package are required. The sqlite3 in Python docs.python.org/3/library/sqlite3.html is an interface not the implementation.
Which linux? Never have I had to install sqlite3 separately on any Debian/Debian derivatives.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.