question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing to install Peewee with Pip

See original GitHub issue

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

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!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
coleifercommented, Jul 18, 2018

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.

2reactions
lyssdodcommented, Jul 18, 2018

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Peewee won't install (Example) | Treehouse Community
Peewee won't install. I can't get peewee to install using the command 'pip install peewee' in my terminal on Mac.
Read more >
Fail to install peewee under WinPython - Stack Overflow
I am trying to pip install peewee on Windows using WinPython (2 or 3) and the installation chokes on the absence of the...
Read more >
Installing and Testing — peewee 3.15.4 documentation
Installing and Testing¶. Most users will want to simply install the latest version, hosted on PyPI: pip install peewee.
Read more >
peewee - PyPI
Peewee is a simple and small ORM. It has few (but expressive) concepts, making it easy to learn and intuitive to use. a...
Read more >
installation problem - Prodigy Support
C:\Users>pip install --no-cache-dir ... ERROR: Failed building wheel for peewee Running setup.py clean for peewee Failed to build peewee ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found