Issue: Failing to install Peewee with Pip
Author: lmm-git
State: closed
Created: 2018-07-18 09:37:25

Hi,

currently I am having a lot of trouble installing Peewee. When executing `pip3 install -r requirements.txt` on a Ubuntu 16.04 LTS I get

```bash
Collecting peewee~=3.6.1
  Using cached https://files.pythonhosted.org/packages/2c/08/b059dd7cc0fa6ae45af86f36660fb0838463390d5626d37b8595e54efd9e/peewee-3.6.1.tar.gz
Building wheels for collected packages: peewee
  Running setup.py bdist_wheel for peewee ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-weh5o8st/peewee/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpaceuk7nvpip-wheel- --python-tag cp35:
  /home/lmm/.local/lib/python3.5/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
    """)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  copying peewee.py -> build/lib.linux-x86_64-3.5
  copying pwiz.py -> build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/fields.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/flask_utils.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/__init__.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/dataset.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/shortcuts.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/sqlite_ext.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/sqlcipher_ext.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/migrate.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/kv.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/apsw_ext.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/signals.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/sqliteq.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/test_utils.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/mysql_ext.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/sqlite_udf.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/hybrid.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/db_url.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/pool.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/postgres_ext.py -> build/lib.linux-x86_64-3.5/playhouse
  copying playhouse/reflection.py -> build/lib.linux-x86_64-3.5/playhouse
  running build_ext
  building 'playhouse._speedups' extension
  creating build/temp.linux-x86_64-3.5
  creating build/temp.linux-x86_64-3.5/playhouse
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c playhouse/_speedups.c -o build/temp.linux-x86_64-3.5/playhouse/_speedups.o
  x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/playhouse/_speedups.o -o build/lib.linux-x86_64-3.5/playhouse/_speedups.cpython-35m-x86_64-linux-gnu.so
  building 'playhouse._sqlite_udf' extension
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c playhouse/_sqlite_udf.c -o build/temp.linux-x86_64-3.5/playhouse/_sqlite_udf.o
  x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/playhouse/_sqlite_udf.o -o build/lib.linux-x86_64-3.5/playhouse/_sqlite_udf.cpython-35m-x86_64-linux-gnu.so
  building 'playhouse._sqlite_ext' extension
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c playhouse/_sqlite_ext.c -o build/temp.linux-x86_64-3.5/playhouse/_sqlite_ext.o
  playhouse/_sqlite_ext.c:531:21: fatal error: sqlite3.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for peewee
  Running setup.py clean for peewee
Failed to build peewee
Installing collected packages: peewee
  Running setup.py install for peewee ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-weh5o8st/peewee/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_l2_k4ko-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    /home/lmm/.local/lib/python3.5/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
      """)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    copying peewee.py -> build/lib.linux-x86_64-3.5
    copying pwiz.py -> build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/fields.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/flask_utils.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/__init__.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/dataset.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/shortcuts.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/sqlite_ext.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/sqlcipher_ext.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/migrate.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/kv.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/apsw_ext.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/signals.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/sqliteq.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/test_utils.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/mysql_ext.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/sqlite_udf.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/hybrid.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/db_url.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/pool.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/postgres_ext.py -> build/lib.linux-x86_64-3.5/playhouse
    copying playhouse/reflection.py -> build/lib.linux-x86_64-3.5/playhouse
    running build_ext
    building 'playhouse._speedups' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/playhouse
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c playhouse/_speedups.c -o build/temp.linux-x86_64-3.5/playhouse/_speedups.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/playhouse/_speedups.o -o build/lib.linux-x86_64-3.5/playhouse/_speedups.cpython-35m-x86_64-linux-gnu.so
    building 'playhouse._sqlite_udf' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c playhouse/_sqlite_udf.c -o build/temp.linux-x86_64-3.5/playhouse/_sqlite_udf.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/playhouse/_sqlite_udf.o -o build/lib.linux-x86_64-3.5/playhouse/_sqlite_udf.cpython-35m-x86_64-linux-gnu.so
    building 'playhouse._sqlite_ext' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c playhouse/_sqlite_ext.c -o build/temp.linux-x86_64-3.5/playhouse/_sqlite_ext.o
    playhouse/_sqlite_ext.c:531:21: fatal error: sqlite3.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-weh5o8st/peewee/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_l2_k4ko-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-weh5o8st/peewee/
You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
```

For me it seems related to the fact I do not have the sqlite dev package installed, but I would think this should not be required for installing peewee, or is it?

Thanks in advance!

The same issue here, but on different system. I think it's due to the https://github.com/coleifer/peewee/blob/master/setup.py#L12, which's now always `True`, and native extensions are always built. @coleifer can it be made tweakable?

The same isssue i guees w/ CentOS 7.5 and python 2.7

```
Collecting peewee
  Using cached https://files.pythonhosted.org/packages/2c/08/b059dd7cc0fa6ae45af86f36660fb0838463390d5626d37b8595e54efd9e/peewee-3.6.1.tar.gz
Installing collected packages: peewee
  Running setup.py install for peewee: started
    Running setup.py install for peewee: finished with status 'error'
    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ZJ06Kr/peewee/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-YKZ06B/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    copying peewee.py -> build/lib.linux-x86_64-2.7
    copying pwiz.py -> build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/signals.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/dataset.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqliteq.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/apsw_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/reflection.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/flask_utils.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/mysql_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/pool.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqlite_udf.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/shortcuts.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/kv.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/migrate.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/db_url.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/__init__.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqlite_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/fields.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/test_utils.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqlcipher_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/hybrid.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/postgres_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    running build_ext
    building 'playhouse._speedups' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/playhouse
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c playhouse/_speedups.c -o build/temp.linux-x86_64-2.7/playhouse/_speedups.o
    gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/playhouse/_speedups.o -L/usr/lib64 -lpython2.7 -o build/lib.linux-x86_64-2.7/playhouse/_speedups.so
    building 'playhouse._sqlite_udf' extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c playhouse/_sqlite_udf.c -o build/temp.linux-x86_64-2.7/playhouse/_sqlite_udf.o
    gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/playhouse/_sqlite_udf.o -L/usr/lib64 -lpython2.7 -o build/lib.linux-x86_64-2.7/playhouse/_sqlite_udf.so
    building 'playhouse._sqlite_ext' extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iplayhouse -I/usr/include/python2.7 -c playhouse/_sqlite_ext.c -o build/temp.linux-x86_64-2.7/playhouse/_sqlite_ext.o
    playhouse/_sqlite_ext.c: В функции «__pyx_f_9playhouse_11_sqlite_ext_pwBestIndex»:
    playhouse/_sqlite_ext.c:5104:25: предупреждение: несовместимый тип указателя в присваивании [по умолчанию включена]
         __pyx_v_pConstraint = (&(__pyx_v_pIdxInfo->aConstraint[__pyx_v_i]));
                             ^
    playhouse/_sqlite_ext.c:5267:23: ошибка: «sqlite3_index_info» не содержит элемента с именем «estimatedRows»
           __pyx_v_pIdxInfo->estimatedRows = 10;
                           ^
    playhouse/_sqlite_ext.c:5296:23: ошибка: «sqlite3_index_info» не содержит элемента с именем «estimatedRows»
           __pyx_v_pIdxInfo->estimatedRows = __Pyx_pow_long(10, ((long)(__pyx_v_nParams - __pyx_v_nArg)));
                           ^
    playhouse/_sqlite_ext.c:5407:21: ошибка: «sqlite3_index_info» не содержит элемента с именем «estimatedRows»
         __pyx_v_pIdxInfo->estimatedRows = 0x186A0;
                         ^
    playhouse/_sqlite_ext.c: В функции «__pyx_f_9playhouse_11_sqlite_ext_18_TableFunctionImpl_create_module»:
    playhouse/_sqlite_ext.c:5608:33: предупреждение: несовместимый тип указателя в присваивании [по умолчанию включена]
       __pyx_v_self->module.xConnect = __pyx_f_9playhouse_11_sqlite_ext_pwConnect;
                                     ^
    playhouse/_sqlite_ext.c: В функции «__pyx_pf_9playhouse_11_sqlite_ext_16ConnectionHelper_8set_update_hook»:
    playhouse/_sqlite_ext.c:16587:5: предупреждение: в передаче аргумента 2 «sqlite3_update_hook»: несовместимый тип указателя [по умолчанию включена]
         (void)(sqlite3_update_hook(__pyx_v_self->conn->db, __pyx_f_9playhouse_11_sqlite_ext__update_callback, ((void *)__pyx_v_fn)));
         ^
    In file included from playhouse/_sqlite_ext.c:594:0:
    /usr/include/sqlite3.h:4826:18: замечание: expected «void (*)(void *, int,  const char *, const char *, sqlite3_int64)» but argument is of type «void (*)(void *, int,  char *, char *, sqlite3_int64)»
     SQLITE_API void *sqlite3_update_hook(
                      ^
    playhouse/_sqlite_ext.c: В функции «__pyx_pf_9playhouse_11_sqlite_ext_16ConnectionHelper_10set_busy_handler»:
    playhouse/_sqlite_ext.c:16699:115: предупреждение: приведение к типу указателя от целого другого размера [-Wint-to-pointer-cast]
       (void)(sqlite3_busy_handler(__pyx_v_self->conn->db, __pyx_f_9playhouse_11_sqlite_ext__aggressive_busy_handler, ((void *)__pyx_v_n)));
                                                                                                                       ^
    playhouse/_sqlite_ext.c: В функции «__pyx_f_9playhouse_11_sqlite_ext__aggressive_busy_handler»:
    playhouse/_sqlite_ext.c:18629:26: предупреждение: приведение указателя к целому другого размера [-Wpointer-to-int-cast]
       __pyx_v_busyTimeout = ((int)__pyx_v_ptr);
                              ^
    playhouse/_sqlite_ext.c: На верхнем уровне:
    playhouse/_sqlite_ext.c:6582:18: предупреждение: «__pyx_f_9playhouse_11_sqlite_ext_validate_and_format_datetime» определена, но нигде не используется [-Wunused-function]
     static PyObject *__pyx_f_9playhouse_11_sqlite_ext_validate_and_format_datetime(PyObject *__pyx_v_lookup, PyObject *__pyx_v_date_str) {
                      ^
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
```

Try:

```
export NO_SQLITE=1
pip install peewee
```

This will ensure that the SQLite C extensions are not built. They depend on `libsqlite3` and the `sqlite3.h` header file, which you appear not to have installed on your system. Previously, these extensions would only be built if you also had Cython, but since in 3.6 I've added the pre-generated C files to the package, the extensions will be built.

There's a bit of info here regarding the SQLite C extensions: http://docs.peewee-orm.com/en/latest/peewee/installation.html#skip-compilation-of-sqlite-extensions

I may have to revise the build if this is problematic for a lot of users, however.

I'm planning a new release, 3.6.2, which will use `ctypes.util.find_library` to determine ahead-of-time if `libsqlite3` is installed. If it is not found, the SQLite extensions will not be built. This should make it no longer necessary to use the above environment variable.

BTW if anyone has a better suggestion for determining if sqlite3 is available, I'm open to ideas. For example, testing compilation of a very minimal C file?

Released 3.6.2 -- hopefully this addresses the issue. Please chime in with comments if you are still experiencing problems after upgrading to 3.6.2 and I will re-open the issue.

@coleifer there are environments when there's no c compiler installed, so I'd check for this first. For me it failed because it tried to look for python headers, which are not installed as well

> so I'd check for this first.

How would you go about testing for the absence of a C compiler?

**Edit**: added here 9bc4547

Latest release is now 3.6.3. Includes test for existence of C compiler as well as a subsequent check for the existence of `libsqlite3`. Please let me know if you encounter issues.

@coleifer it still tries to build `_speedups` extension and fails:
<img width="1061" alt="screen shot 2018-07-18 at 19 27 43" src="https://user-images.githubusercontent.com/2615950/42897672-00100604-8ac1-11e8-8215-0452fdc9d079.png">


@lyssdod -- is there a reason you cannot install the Python headers? Typically it's a package called `python-dev`.

Yes, I know. The reason is I'm using `pip download` to download packages and install them later, and the target system is kind of embedded environment, which doesn't have headers installed

Hi, I'm also encountering the issue mentioned here on release 3.6.3. I'm using Python 3.5 on Ubuntu 16.04 Xenial, and I have the latest version of `python-dev` available, and have a c-compiler installed. Attempting to install in a clean environment causes the same issue.

Adding `NO_SQLITE=True` does allow me to install 3.6.3.

Alright...I think I finally have a solution that should work for everyone. Pushed a new release, 3.6.4, which contains the changes.

I've changed approaches and now am using an approach similar to what `simplejson` does. First we'll try to build the extensions (assuming we're on CPython and not pypy or something), and if that fails we fall-back to a pure-python build.

This should fix the (admittedly baffling to me) situation where you have installed both Python *and* a C compiler, but not the header files.

@madelyneriksen -- what traceback are you seeing, an error about missing "sqlite3.h"? What do you get when you run:

```python
>>> from ctypes.util import find_library
>>> find_library('sqlite3')
```

@coleifer Yep, the traceback was about "sqlite3.h".

Here's the output from that Python Session:
```
>>> from ctypes.util import find_library
>>> find_library('sqlite3')
'libsqlite3.so.0'
```

I just tried installing version 3.6.4 to a new environment, and it works perfectly. The issue on my system regarding headers seems resolved. Thank you!

Sure thing, thanks for verifying that @madelyneriksen -- I had mistakenly assumed that the presence of the shared library would mean that the headers would be available also (for sqlite). At any rate, the fix in 3.6.4 should resolve the issue. If you wish to build the C extensions, you'll want to install the `libsqlite3-dev` package (which should include sqlite3.h).

@coleifer Thanks, it works as expected now!

Hey, guys :D
Sorry for being late, but I ask you please to add these dependencies to some doc 'cause it was time consuming to find it in 2023.

libsqlite3-dev
cython

Thanks for you hard work.

Those shouldn't be hard dependencies - they are optional for the extensions.

That's fine, this is not the right place for this.
Sorry 😬