7

I've created virtualenv with:

mkvirtualenv -p /usr/bin/python3.4 django

After, I tried install pysqlite:

pip install pysqlite

But I got:

Downloading/unpacking pysqlite
  Downloading pysqlite-2.6.3.tar.gz (76kB): 76kB downloaded
  Running setup.py (path:/home/sigo/.virtualenvs/django/build/pysqlite/setup.py) egg_info for package pysqlite
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/home/sigo/.virtualenvs/django/build/pysqlite/setup.py", line 85
        print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
                                                                           ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/home/sigo/.virtualenvs/django/build/pysqlite/setup.py", line 85

    print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."

                                                                       ^

SyntaxError: invalid syntax

It seems that pip try use python2. How can I resolve this?

4
  • Check that you have pip for python 3. This will be named something like pip-3.2. Commented Apr 20, 2014 at 10:54
  • Using pip3 and pip3.4 causes the same error. Commented Apr 20, 2014 at 10:55
  • A quick look seems to suggest you need to install pysqlite3 Commented Apr 20, 2014 at 10:58
  • 1
    That syntax error about the print statement reveals pysqlite is written in Python2, not Python3. sadlly, seems like the @ghaering answer is right. Commented Feb 26, 2015 at 14:35

2 Answers 2

10

There is no public version of pysqlite for Python 3.x. For Python 3.x, the sqlite3 module in the standard library is the most up-to date version of pysqlite there is.

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

3 Comments

Do you have a suggestion on how to get FTS3/4 support for sqlite3 then? I was hoping to get it by installing a pysqlite with pip.
If Python loads a SQLite shared library with FTS3/FTS4 support, then you're fine. The Python sqlite3 module or pysqlite do not need to be recompiled.
If you download the latest sqlite-autoconf-* file and install it with ./configure --prefix=/opt/sqlite3 make -j4 install then it is by default built with the fts3 and rtree extensions. You can then export LD_LIBRARY_PATH=/opt/sqlite3/lib and subsequently started Python processes will pick up the just installed sqlite3 library. On Mac, it's DYLD_LIBRARY_PATH instead.
1

I'm following this procedure to include the JSON1 extension for SQLite.

When running the

python setup.py install

command for pysqlite within a virtual environment (miniconda) I receive the following output:

pysqlite is not supported on Python 3. When using Python 3, use the sqlite3 module from the standard library.

Setting

export LD_LIBRARY_PATH=~/bin/jqlite/lib

doesn't change this.

1 Comment

My fault. I got confused here. Pysqlite is not needed as I understand and by setting the LD_LIBRARY_PATH within the virtual environment it should be possible to use the JSON1 extension of the sqlite3 module. I will check and provide information on that soon.

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.