1

I just transferred a python module from my OS X system to Ubuntu. The module runs on the Mac just fine, but fails on the Ubuntu system with the following error:

import sqlite3

File "/usr/local/lib/python3.4/sqlite3/init.py", line 23, in from sqlite3.dbapi2 import *

File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 26, in from _sqlite3 import *

ImportError: No module named '_sqlite3'

Some of the answers I have found so far do not seem to acknowledge that this error is generated within the the Python libraries. Others suggest reinstallation of Python and/or Sqlite. I have reinstalled both (forced reinstalls), making sure that Python3 was installed after Sqlite3. Still no joy.

As I said, the code runs on the Mac. Prior to the introduction sqlite3, the common code base ran on Ubuntu as well. Several installs and updates in the past, for similar applications, I used sqlite3 with earlier versions of Python (perhaps not Python3?). I am looking for additional suggestions - for a fix or for debugging investigation.

0

You seem to have tried a lot of solutions already, so I do not know exactly whether this is new to you or not. At any rate, I faced a similar problem with the same exact error code. My notes of the time say say that I solved this problem by installing the developer's version of the library, libsqlite3-dev.

With time, I have discovered that this is kind of a good empirical rule: when something fails, and you think you have all the relevant packages, the failure is due to the lack of the -dev library package.

Should this not be enough, how about running an strace? Perhaps this might add some helpful info.

  • Thanks for the suggestion, but apt-get confirms that libsqlite3-dev is already installed with the most recent version. I have not previously used strace. Early investigations say that it traces Linux kernel calls. The error message looks a lot more like a Python or Sqlite library problem, though. After a few more reinstalls of Python3 and recreations of virtual environments, I may give strace a try. – user96 Jul 5 '15 at 14:37
0

This question is not worth pursuing. My resolution, after a few more attempts at repairing the installation was to replace the Ubuntu VM with fresh installations of everything required to run the application. Now everything works fine.

It's funny how we develop tunnel vision and wind up searching for an answer instead of a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.