coleifer / pysqlite3

SQLite3 DB-API 2.0 driver from Python 3, packaged separately, with improvements
zlib License
183 stars 51 forks source link

Pip install fails on MacOS with Python 3.12 #75

Closed jasonzliang closed 2 months ago

jasonzliang commented 2 months ago

Hi, when I try to do "pip install pysqlite3", I get the following error below. I tried installing sqlite3 via homebrew but the problem persists. What should I do to fix this?

`Collecting pysqlite3 Using cached pysqlite3-0.5.3.tar.gz (40 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: pysqlite3 Building wheel for pysqlite3 (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pysqlite3 (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [32 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.macosx-14.0-arm64-cpython-312 creating build/lib.macosx-14.0-arm64-cpython-312/pysqlite3 copying pysqlite3/init.py -> build/lib.macosx-14.0-arm64-cpython-312/pysqlite3 copying pysqlite3/dbapi2.py -> build/lib.macosx-14.0-arm64-cpython-312/pysqlite3 running build_ext Builds a C extension linking against libsqlite3 library building 'pysqlite3._sqlite3' extension creating build/temp.macosx-14.0-arm64-cpython-312 creating build/temp.macosx-14.0-arm64-cpython-312/src clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Qunused-arguments -DMODULE_NAME=\"pysqlite3.dbapi2\" -I/usr/include -I/Users/jason1/base/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/blob.c -o build/temp.macosx-14.0-arm64-cpython-312/src/blob.o clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Qunused-arguments -DMODULE_NAME=\"pysqlite3.dbapi2\" -I/usr/include -I/Users/jason1/base/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/cache.c -o build/temp.macosx-14.0-arm64-cpython-312/src/cache.o clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Qunused-arguments -DMODULE_NAME=\"pysqlite3.dbapi2\" -I/usr/include -I/Users/jason1/base/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/connection.c -o build/temp.macosx-14.0-arm64-cpython-312/src/connection.o src/connection.c:1389:10: error: call to undeclared function 'sqlite3_enable_load_extension'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] rc = sqlite3_enable_load_extension(self->db, onoff); ^ src/connection.c:1389:10: note: did you mean 'pysqlite_enable_load_extension'? src/connection.c:1376:18: note: 'pysqlite_enable_load_extension' declared here static PyObject pysqlite_enable_load_extension(pysqlite_Connection self, PyObject args) ^ src/connection.c:1413:10: error: call to undeclared function 'sqlite3_load_extension'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] rc = sqlite3_load_extension(self->db, extension_name, 0, &errmsg); ^ src/connection.c:1413:10: note: did you mean 'pysqlite_load_extension'? src/connection.c:1399:18: note: 'pysqlite_load_extension' declared here static PyObject pysqlite_load_extension(pysqlite_Connection self, PyObject args) ^ 2 errors generated. error: command '/usr/bin/clang' failed with exit code 1 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pysqlite3 Failed to build pysqlite3 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pysqlite3)`

coleifer commented 2 months ago

Looks like your header is missing the declaration for sqlite3_enable_load_extension