coleifer / pysqlite3

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

Failed to pip install pysqlite3 on Mac OS 12.6 #46

Closed mJace closed 1 year ago

mJace commented 1 year ago

Hi, I'm having trouble installing pysqlite3 on Mac (OS 12.6) Is pysqlite3 support Mac?

pip3 install pysqlite3
Collecting pysqlite3
  Using cached pysqlite3-0.5.0.tar.gz (40 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pysqlite3
  Building wheel for pysqlite3 (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [46 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-12.6-x86_64-3.9
      creating build/lib.macosx-12.6-x86_64-3.9/pysqlite3
      copying pysqlite3/__init__.py -> build/lib.macosx-12.6-x86_64-3.9/pysqlite3
      copying pysqlite3/dbapi2.py -> build/lib.macosx-12.6-x86_64-3.9/pysqlite3
      running build_ext
      Builds a C extension linking against libsqlite3 library
      building 'pysqlite3._sqlite3' extension
      creating build/temp.macosx-12.6-x86_64-3.9
      creating build/temp.macosx-12.6-x86_64-3.9/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Qunused-arguments -DMODULE_NAME="pysqlite3.dbapi2" -I/usr/include -I/Users/jace/.pyenv/versions/3.9.2/include/python3.9 -c src/blob.c -o build/temp.macosx-12.6-x86_64-3.9/src/blob.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Qunused-arguments -DMODULE_NAME="pysqlite3.dbapi2" -I/usr/include -I/Users/jace/.pyenv/versions/3.9.2/include/python3.9 -c src/cache.c -o build/temp.macosx-12.6-x86_64-3.9/src/cache.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Qunused-arguments -DMODULE_NAME="pysqlite3.dbapi2" -I/usr/include -I/Users/jace/.pyenv/versions/3.9.2/include/python3.9 -c src/connection.c -o build/temp.macosx-12.6-x86_64-3.9/src/connection.o
      src/connection.c:1303:9: warning: 'sqlite3_trace' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
              sqlite3_trace(self->db, 0, (void*)0);
              ^~~~~~~~~~~~~
              sqlite3_trace_v2
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sqlite3.h:3223:36: note: 'sqlite3_trace' has been explicitly marked deprecated here
      SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(
                                         ^
      src/connection.c:1306:9: warning: 'sqlite3_trace' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
              sqlite3_trace(self->db, _trace_callback, trace_callback);
              ^~~~~~~~~~~~~
              sqlite3_trace_v2
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sqlite3.h:3223:36: note: 'sqlite3_trace' has been explicitly marked deprecated here
      SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(
                                         ^
      src/connection.c:1328:10: error: implicit declaration of function 'sqlite3_enable_load_extension' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          rc = sqlite3_enable_load_extension(self->db, onoff);
               ^
      src/connection.c:1328:10: note: did you mean 'pysqlite_enable_load_extension'?
      src/connection.c:1315:18: note: 'pysqlite_enable_load_extension' declared here
      static PyObject* pysqlite_enable_load_extension(pysqlite_Connection* self, PyObject* args)
                       ^
      src/connection.c:1352:10: error: implicit declaration of function 'sqlite3_load_extension' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          rc = sqlite3_load_extension(self->db, extension_name, 0, &errmsg);
               ^
      src/connection.c:1352:10: note: did you mean 'pysqlite_load_extension'?
      src/connection.c:1338:18: note: 'pysqlite_load_extension' declared here
      static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* args)
                       ^
      2 warnings and 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
  Running setup.py clean for pysqlite3
Failed to build pysqlite3
Installing collected packages: pysqlite3
  Running setup.py install for pysqlite3 ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pysqlite3 did not run successfully.
  │ exit code: 1
  ╰─> [46 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.macosx-12.6-x86_64-3.9
      creating build/lib.macosx-12.6-x86_64-3.9/pysqlite3
      copying pysqlite3/__init__.py -> build/lib.macosx-12.6-x86_64-3.9/pysqlite3
      copying pysqlite3/dbapi2.py -> build/lib.macosx-12.6-x86_64-3.9/pysqlite3
      running build_ext
      Builds a C extension linking against libsqlite3 library
      building 'pysqlite3._sqlite3' extension
      creating build/temp.macosx-12.6-x86_64-3.9
      creating build/temp.macosx-12.6-x86_64-3.9/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Qunused-arguments -DMODULE_NAME="pysqlite3.dbapi2" -I/usr/include -I/Users/jace/.pyenv/versions/3.9.2/include/python3.9 -c src/blob.c -o build/temp.macosx-12.6-x86_64-3.9/src/blob.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Qunused-arguments -DMODULE_NAME="pysqlite3.dbapi2" -I/usr/include -I/Users/jace/.pyenv/versions/3.9.2/include/python3.9 -c src/cache.c -o build/temp.macosx-12.6-x86_64-3.9/src/cache.o
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Qunused-arguments -DMODULE_NAME="pysqlite3.dbapi2" -I/usr/include -I/Users/jace/.pyenv/versions/3.9.2/include/python3.9 -c src/connection.c -o build/temp.macosx-12.6-x86_64-3.9/src/connection.o
      src/connection.c:1303:9: warning: 'sqlite3_trace' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
              sqlite3_trace(self->db, 0, (void*)0);
              ^~~~~~~~~~~~~
              sqlite3_trace_v2
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sqlite3.h:3223:36: note: 'sqlite3_trace' has been explicitly marked deprecated here
      SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(
                                         ^
      src/connection.c:1306:9: warning: 'sqlite3_trace' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
              sqlite3_trace(self->db, _trace_callback, trace_callback);
              ^~~~~~~~~~~~~
              sqlite3_trace_v2
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sqlite3.h:3223:36: note: 'sqlite3_trace' has been explicitly marked deprecated here
      SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(
                                         ^
      src/connection.c:1328:10: error: implicit declaration of function 'sqlite3_enable_load_extension' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          rc = sqlite3_enable_load_extension(self->db, onoff);
               ^
      src/connection.c:1328:10: note: did you mean 'pysqlite_enable_load_extension'?
      src/connection.c:1315:18: note: 'pysqlite_enable_load_extension' declared here
      static PyObject* pysqlite_enable_load_extension(pysqlite_Connection* self, PyObject* args)
                       ^
      src/connection.c:1352:10: error: implicit declaration of function 'sqlite3_load_extension' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          rc = sqlite3_load_extension(self->db, extension_name, 0, &errmsg);
               ^
      src/connection.c:1352:10: note: did you mean 'pysqlite_load_extension'?
      src/connection.c:1338:18: note: 'pysqlite_load_extension' declared here
      static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* args)
                       ^
      2 warnings and 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: legacy-install-failure

× Encountered error while trying to install package.
╰─> pysqlite3

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
coleifer commented 1 year ago

Your system sqlite3 appears to not support runtime loadable extensions, would be my guess. I suggest installing a newer SQLite and building a statically linked pysqlite3. Instructions are in the readme.