Symbol not found: _sqlite3_enable_load_extension - sqlite installed via homebrew Symbol not found: _sqlite3_enable_load_extension - sqlite installed via homebrew sqlite sqlite

Symbol not found: _sqlite3_enable_load_extension - sqlite installed via homebrew


Copied answer from here (https://github.com/Homebrew/homebrew-core/pull/3134). If you're like me, you probably installed sqlite after you install python3. Anyway, if anyone stumbles upon this question and needs an answer...

First remove SQLite, python and python3 if installed via homebrew

brew uninstall --force pythonbrew uninstall --force python3brew uninstall --force sqlite

This removes all copies.

Then make sure Xcode 8 or later is installed

Important

Re-install command line tools via

xcode-select --installsudo xcode-select --reset

and finally install command line tools via pkg file found here.

Look for command line tools in search. (I've downloaded "Command Line Tools (macOS 10.12) for Xcode 8.dmg") Then open DMG and install the pkg found there.

Now install SQLite and then python and python 3 if needed:

brew install sqlitebrew install pythonbrew install python3

Run brew install python --verbose and make sure there are no warnings, if none then issues should be resolved.

Don't forget to do

pip install setuptools --upgrade && pip3 install setuptools --upgrade


It may happen because it's not able to locate the .so library. As explained here:

On OS X, homebrew installs sqlite3 as “keg-only” because otherwise it interferes with the system sqlite3. This means that libsqlite3.dylib ends up in /usr/local/opt/sqlite/lib, not in /usr/local/lib

So you can simply do this:

export DYLD_LIBRARY_PATH=/usr/local/opt/sqlite/lib:/usr/lib

Then you should be able to import sqlite3.