Python SQLite Wrapper apsw-3.7.16.2 failed to install in mac os x (10.7.5)

1.1k Views Asked by At

Failed to install sqlite wrapper. Any help with installation will be really helpful.

Downloaded from

Installed sqlite3.version '2.6.0'

Please find the error log below-

sudo python setup.py install test
running install
running build
running build_ext
SQLite: Using system sqlite include/libraries
running install_lib
running install_egg_info
Removing /Library/Python/2.7/site-packages/apsw-3.7.16.2_r1-py2.7.egg-info
Writing /Library/Python/2.7/site-packages/apsw-3.7.16.2_r1-py2.7.egg-info
running test
Traceback (most recent call last):
File "setup.py", line 857, in <module>
 'win64hackvars': win64hackvars}
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 102, in run
import tests
 File "/Users/tj/Downloads/apsw-3.7.16.2-r1/tests.py", line 9, in <module>
import apsw
ImportError: dlopen(/Users/tj/Downloads/apsw-3.7.16.2-r1/apsw.so, 2): Symbol not found: _sqlite3_db_filename
Referenced from: /Users/tj/Downloads/apsw-3.7.16.2-r1/apsw.so
Expected in: flat namespace
in /Users/tj/Downloads/apsw-3.7.16.2-r1/apsw.so
1

There are 1 best solutions below

2
Roger Binns On

It is picking up the system SQLite shared library which is an older version. MacOS tends to ignore the SQLite library you want it to use and force using a known system one. (Many OS components like CoreData depend on SQLite which is why they like to force using a known good version.)

The easiest fix is to use the command line as specified in the documentation. It ensures a private copy of SQLite is embedded in the extension and hence will always work.

http://apidoc.apsw.googlecode.com/hg/build.html#recommended

python setup.py fetch --all build --enable-all-extensions install test

(I'm the APSW author). BTW there is a python-sqlite mailing list which you may find useful.