We can fix Modulenotfounderror no module named sqlite3 error by explicitly installing pysqlite python module or updating the packages in existing python. Because default python also offers sqlite database as an inbuilt feature. In this article, we will explore both ways.
Modulenotfounderror no module named sqlite3 ( Solution ) –
Since we have mentioned whether we explicitly install the pysqlite package or we can update the internal python and Linux platforms to avoid any kind of incompatibility.
Solution 1: Installing pysqlite explicitly –
The best way to install pysqlite is by using pip package manager. There is a single command which we need to run and it will download and install the package.
pip install pysqlite
It will install the latest version for pysqlite but if you want to install version specific package then you need to add the version below –
pip install pysqlite==2.8.2
For admin right, you can add sudo keyword with the command.
If you are using conda package manager, you can run the below command for installation.
conda install -c kbchoi pysqlite
Solution 2: Updating internal python package –
In some cases, we have seen we somehow corrupt the default python for linux or we install some external package that indirectly creates incompatibility of platform Linux with python. Here we need to update the internal packages. Here is the command for resolution.
1. Option 1:
yum install sqlite-devel -y
2. Option 2:
sudo apt-get install libsqlite3-dev
3. Option 3:
Here is another alternative of updating sqlite-devel and recompiling the files.
yum install sqlite-devel
./configure --enable-optimizations --enable-loadable-sqlite-extensions
You can try either option for fixing this platform incompatibility issue. This SQLlite database is very useful in creating a web applications. It is also scalable at some extent especially for small web applications using the python back-end flask framework is very compatible with it. There are some other general ways to fix any modulenotfounderror. Here is the complete article for the same.
Data Science Learner Team
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.