Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install pysqlite in virtualenv with python3 support

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?

like image 768
Mateusz Jagiełło Avatar asked Apr 20 '14 10:04

Mateusz Jagiełło


People also ask

How do I install virtualenv in Python?

Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip. Unix/macOS python3 -m pip install --user virtualenv Windows py -m pip install --user virtualenv Creating a virtual environment¶

How to create a virtual environment for Python applications?

You must have the following packages installed on your system. You must have Python 3 and PIP installed on your system. We use virtualenv package to create virtual environment for the Python applications. So first install virtualenv Python module using command:

What is pysqlite in Python?

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.

How do I install virtualenv using PIP3?

If you're working with Python 3, you must install virtualenv using pip3. pip3 is not installed on the server by default. You must first install a custom version of Python 3. This custom installation of Python 3 will also contain pip3. After it's installed and activated, run the which python3 command as shown in the article.


2 Answers

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.

like image 151
ghaering Avatar answered Sep 24 '22 11:09

ghaering


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.

like image 42
markj Avatar answered Sep 21 '22 11:09

markj