0

I installed Python 3.5.2 on my godaddy hosted server and get the following error when I try "import sqlite3." Why?

Python 3.5.2 (default, Nov  7 2016, 09:01:17)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/olgo/.local/lib/python3.5/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/home/olgo/.local/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named '_sqlite3'
>>>

Further info, when trying to upgrade the package:

python3 -m pip install --upgrade sqlite3
Collecting sqlite3
  Using cached sqlite3-99.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-mgkpf7dd/sqlite3/setup.py", line 2, in <module>
        raise RuntimeError("Package 'sqlite3' must not be downloaded from pypi")
    RuntimeError: Package 'sqlite3' must not be downloaded from pypi

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mgkpf7dd/sqlite3/
Olgo
  • 35
  • 1
  • 6
  • 1
    I don't know enough about the server environment to be confident enough to mark this as a dupe, but it _looks_ a lot like http://stackoverflow.com/q/1210664/748858. – mgilson Nov 07 '16 at 17:03
  • I saw that one and tried many of those solutions, none of which worked for me. Considering there were none marked as answered I couldn't determine if this is this is a duplicate to that question. – Olgo Nov 07 '16 at 17:07
  • @mgilson: pretty certain this is the exact same issue. Python wasn't compiled with sqlite support, make sure the sqlite development headers are available when you build Python. – Martijn Pieters Nov 07 '16 at 17:07
  • You can't install `sqlite3` from PyPI, no. You are on Redhat, look for a `sqlite-devel` or similar package, install it, recompile Python. – Martijn Pieters Nov 07 '16 at 17:09

0 Answers0