Issue: CSqliteExtDatabase not available
Author: Nixellion
State: closed
Created: 2021-03-03 12:44:07

Hi! I've been banging my head against this for a few days now, but I can't figure out how to install peewee with pip and make Cython modules work.

When I run `pip install Cython` and `pip install peewee` it just goes:

```
Collecting peewee
Installing collected packages: peewee
Successfully installed peewee-3.14.1
```

And nothing about building anything. But then using

```
from playhouse.sqlite_ext import CSqliteExtDatabase
```

does not work.

Same behavior on Windows and Linux (Debian 10).
Python 3.8.x and 3.7.3

What am I missing?

Are you sure cython is installed?
Did you install the python headers? Should be apt install python-dev.
Lastly you want sqlite headers. apt install libsqlite3-dev.

I ran those commands, python3-dev was already installed. Just in case installed python-dev as well.

ran `apt install libsqlite3-dev` as well.

Then uninstalled and installed peewee again.

Still nothing.

```
>>> from playhouse.sqlite_ext import CSqliteExtDatabase
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'CSqliteExtDatabase' from 'playhouse.sqlite_ext' (/usr/local/lib/python3.7/dist-packages/playhouse/sqlite_ext.py)
```

Oh okay. I had to install `cython` with `apt` not with `pip`. 

After that I had to uninstall and install peewee again with `pip3 install peewee --no-cache-dir`, that did run `setup.py` and it took a few seconds unlike usually, I guess it was compiling it.

Now importing of that module works.

How should I approach this on Windows then? Or should I just bite it and work around it somehow and only use it on lin? Currently I just use try-except and import standard SqliteExtDatabase instead of CSqliteExtDatabase and dont run stuff that requires Cython extensions. But it would be nice to be able to quickly test it while developing, sadly I do use Windows for development.

It's not necessary to install cython with apt but I suppose something weird is going on with your environment.

That is a clean Debian 10 install. Also tried on WSL and on Ubuntu 20.04. 

Ubuntu 20.04 did not require installing cython with `apt` - that's 100%. But I did not pay attention to that on Debian and WSL.

So I suppose it was just the missing `libsqlite3-dev`.

Anyway it would be great if documentation page actually included these dependencies, here for example: http://docs.peewee-orm.com/en/latest/peewee/installation.html

Or setup.py could print a warning messaging with instructions. 

What do you think?

And thanks for you help.


This already exists.

* http://docs.peewee-orm.com/en/latest/peewee/installation.html#optional-dependencies
* http://docs.peewee-orm.com/en/latest/peewee/installation.html#note-on-the-sqlite-extensions
* https://github.com/coleifer/peewee/blob/d9a58399ba3f55199451d6a612473eafb5c58fe6/setup.py#L96-L103

I don't see any mention of `libsqlite3-dev` on the page, neither `python-dev`. 

Also for some reason those warnings were not printed in any of the tests I ran on all 4 systems. If I saw them I would probably not even be here.

Those are debian-specific package names. The docs and the setup.py script both specify the requirements.