How to install pysqlite?

modulenotfounderror: no module named '_sqlite3'
pysqlite vs sqlite3
pysqlite documentation
sqlite3 python
install sqlite3
python connect to sqlite

I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:

gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install

At the last step I have a problem. I get the following error message:

error: command 'gcc' failed with exit status 1

I found that other peoples also had this problem.

As far as I understood in the person had a problem because sqlite2 was not installed. But in my case, I have sqlite3 (I can run it from command line).

May be I should change some paths in "setup.cfg"? At the moment I have there:

#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION

And if I type "which sqlite3" I get:

/usr/bin/sqlite3

I saw a similar question here. The answer was "you need sqlite3-dev". But, even if it is the case, how to check if I have sqlite3-dev. And if I do not have it how to get it?

Can anybody pleas help me with that problem.

Thank you in advance.

how to check if I have "sqlite3-dev"

That's entirely dependent on what Linux distro you're using -- is it Fedora, Suse, Ubuntu, Gentoo, Mandrake, or which other one out of the dozens out there; there are several packaging strategies and tools used to check which packages are there, get more, and so forth.

So, never ask questions about checking, getting or tweaking packages on Linux without specifying the distribution[s] of interest -- it makes it essentially impossible to offer precise, specific help.

Edit: the simplest way I know of getting details about your Linux distribution (works on all the ones I have at hand to try, but I don't have a particularly wide array...;-):

$ cat /etc/*-release
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.2"
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
...etc, etc...

This is probably going to be the contents of file /etc/lsb-release, but I'm suggesting the *-release because I think there may be some other such files involved.

Of course, if the need to check your distro applies inside a file or program, reading this file (or files) and locating specific contents will also be quite feasible; but for the purpose of informing would-be helpers about what distro you're using, the cat at the shell prompt is going to be quite sufficient;-).

pysqlite · PyPI, pysqlite 2.8.3. pip install pysqlite. Copy PIP instructions. Latest version. Released​: Aug 30, 2016. DB-API 2.0 interface for SQLite 3.x  pysqlite installation guide - installing from source on Windows. Step 1: Download and install required tools. Step 2: Download and compile SQLite. Step 3: Compile pysqlite. Step 4: Install pysqlite or create an installer. Step 5: Test your pysqlite installation.

For Debian distros I fixed this problem with

sudo apt-get install libsqlite3-dev

How to install pysqlite?, how to check if I have "sqlite3-dev". That's entirely dependent on what Linux distro you're using -- is it Fedora, Suse, Ubuntu, Gentoo, Mandrake  Python interface to SQLite 3. pysqlite is an interface to the SQLite 3.x embedded relational database engine. It is almost fully compliant with the Python database API version 2.0 also exposes the unique features of SQLite.

I was able to resolve the same build error by installing the sqlite-devel package:

sudo yum install sqlite-devel

pysqlite installation guide, Steps: - `Step 1: Satisfy the dependencies`_ - `Step 2: Compile pysqlite`_ - `Step 3: Install pysqlite`_ - `Step 4: Test your pysqlite installation`_ Step 1: Satisfy The  Installing SQLite is simple and straightforward. First, create a new folder e.g., C:\sqlite. Second, extract the content of the file that you downloaded in the previous section to the C:\sqlite folder. You should see three programs in the C:\sqlite folder as shown below:

I had the same problem, I'm using python 2.4, neither sqlite3-dev nor libsqlite3-dev are available for CentOS.

yum install python-devel

seems to solve the issue.

PySqlite – The Trac Project, py", line 13, in <module> from pysqlite2 import dbapi2 as sqlite3 ModuleNotFoundError: No module named 'pysqlite2' $ pipenv install pysqlite  PySQLite. The PySQLite provides a standardized Python DBI API 2.0 compliant interface to the SQLite database. If your application needs to support not only the SQLite database but also other databases such as MySQL, PostgreSQL, and Oracle, the PySQLite is a good choice. PySQLite is a part of the Python Standard library since Python version 2.5

What version of Python do you have? SQLite is integrated in Python since 2.5:

http://docs.python.org/library/sqlite3.html

If you insist on compiling it yourself, the package is called sqlite3-devel, you can find it e.g. here

pysqlite2 error after installing in Python 3.6 pipenv · Issue #4181 , SQLite3 or SQLite is a database that can be installed in systems. i.e. In Debian based virtualenv sqlex; source sqlex/bin/activate; cd sqlex; pip install pysqlite. pysqlite3 0.4.2 pip install pysqlite3 Copy PIP instructions. Latest version. Released: Jan 30, 2020 DB-API 2.0 interface for Sqlite 3.x. Navigation.

How to install SQLite3 in Python 3, Quick Install Instructions of python-pysqlite2 on Ubuntu Server. It's Super Easy! simply click on Copy button to copy the command and paste into your command  How to install and use SQLite on Windows When one is developing in .NET with Visual Studio and other Microsoft tools, it is easy to lose sight of alternative solutions to common problems. MS does a competent job of creating a tightly integrated development tool chain, where available MS products (both free and paid) offer reasonable default

How to install python-pysqlite2 ubuntu package on Ubuntu 18.04 , Hi all, I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I Installing the Command-Line Program (CLP) on your machine: Step 1) Download the highlighted download package from the previous image to your PC. It is a " zip " file. Step 2) Extract the zip file. You will find the " sqlite3.exe " in the extracted file as following: Step 3) Open My Computer, and

How to install pysqlite?, PySQLite. The PySQLite provides a standardized Python DBI API 2.0 compliant interface to the SQLite database. If your application needs to support not only the​  Install SQLite on Windows. Step 1 − Go to SQLite download page, and download precompiled binaries from Windows section. Step 2 − Download sqlite-shell-win32-*.zip and sqlite-dll-win32-*.zip zipped files. Step 3 − Create a folder C:\>sqlite and unzip above two zipped files in this folder, which will give you sqlite3.def,

Comments
  • If I type sys.version in Python session I get: '2.4.3 (#1, Jan 21 2009, 01:11:33) \n[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]'. Does it mean that I have version 2.4.3 and I have no chance to use SQLite with this version?
  • I do not insist on compiling it myself. Actually, I do not know if I need to compile. I also do not know how to compile.
  • I do not know if my system use RPM package (I never used 'yum', probably because I never installed anything).
  • tinkertim, I did not get. You say that on system that use RPM packages and on most Debian based systems the package name is the same (sqlite3-devel)? Anyway, even if I know the package name, how should I use it? Should I install the package? If yes, how I do it? Moreover, I do not have administrator permissions on the computer. Will it be a problem?
  • OK. Than how can I find out my Linux distro?
  • @Verrtex, edited my answer to provide advice on this new question of yours.
  • My system tells me: CentOS release 5.3 (Final).
  • For CentOS 5.3, try e.g. the instructions here: tuxmark.blogspot.com/2009/07/build-python-26-on-centos-53.html which should give you Python 2.6 (incorporating sqlite and much other goodness besides). (I have no CentOS 5.3 installation to verify those instructions, but, on the surface, they seem correct).
  • is there something similar for windows ?
  • @AnkushRathi: There are Python and Sqlite packages for Chocolatey (Windows package manager), but I'm not sure if these will do the trick.
  • If I type sys.version in Python session I get: '2.4.3 (#1, Jan 21 2009, 01:11:33) \n[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]'. Does it mean that I have version 2.4.3 and I have no chance to use SQLite with this version?
  • I do not insist on compiling it myself. Actually, I do not know if I need to compile. I also do not know how to compile.
  • @Verrtex, it IS possible to build sqlite for Python 2.4 (although installing and using a more recent version of Python also has other advantages -- don't overwrite the system-supplied version, that might break some things, but installing a newer one e.g. in /usr/local is perfectly fine).
  • I do not know if my system use RPM package (I never used 'yum', probably because I never installed anything).
  • I did not get. You say that on system that use RPM packages and on most Debian based systems the package name is the same (sqlite3-devel)? Anyway, even if I know the package name, how should I use it? Should I install the package? If yes, how I do it? Moreover, I do not have administrator permissions on the computer. Will it be a problem?