2

I'm running python 2.7.3 which I manually installed in my home directory as I don't have root access. 2.6.6 is installed on the system, but I really need 2.7. When I run the app, SQLAlchemy throws this ImportError. So I know that pysqlite2 is now sqlite3 in 2.7, so I'm guessing it's getting confused as to which version of python is installed.

Here's a traceback:

[11/Jan/2013:16:04:57] ENGINE Listening for SIGHUP.
[11/Jan/2013:16:04:57] ENGINE Listening for SIGTERM.
[11/Jan/2013:16:04:57] ENGINE Listening for SIGUSR1.
[11/Jan/2013:16:04:57] ENGINE Bus STARTING
[11/Jan/2013:16:04:57] ENGINE Starting up DB access
[11/Jan/2013:16:04:57] ENGINE Error in 'start' listener <bound method SAEnginePlugin.start of <giraffe.sa.saplugin.SAEnginePlugin object at 0x239c6d0>>
Traceback (most recent call last):
  File "/assetuser/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/process/wspbus.py", line 197, in publish
    output.append(listener(*args, **kwargs))
  File "/assetuser/giraffe_server/giraffe/sa/saplugin.py", line 35, in start
    self.sa_engine = create_engine('sqlite:///giraffe.db', echo=False)
  File "/assetuser/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 338, in create_engine
    return strategy.create(*args, **kwargs)
  File "/assetuser/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 64, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/assetuser/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 286, in dbapi
    raise e
ImportError: No module named pysqlite2

CherryPy Checker:
dir is an absolute path, even though a root is provided.
section: [/Project]
root: '/assetuser/giraffe_server/static'
dir: '/assetuser/Project'

[11/Jan/2013:16:04:57] ENGINE Started monitor thread 'Autoreloader'.
[11/Jan/2013:16:04:57] ENGINE Started monitor thread '_TimeoutMonitor'.
[11/Jan/2013:16:04:57] ENGINE Serving on 0.0.0.0:8080
[11/Jan/2013:16:04:57] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
  File "/assetuser/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/process/wspbus.py", line 235, in start
    self.publish('start')
  File "/assetuser/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/process/wspbus.py", line 215, in publish
    raise exc
ChannelFailures: ImportError('No module named pysqlite2',)

[11/Jan/2013:16:04:57] ENGINE Bus STOPPING
[11/Jan/2013:16:04:57] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down
[11/Jan/2013:16:04:57] ENGINE Stopped thread 'Autoreloader'.
[11/Jan/2013:16:04:57] ENGINE Stopped thread '_TimeoutMonitor'.
[11/Jan/2013:16:04:57] ENGINE Shutting down DB access
[11/Jan/2013:16:04:57] ENGINE Bus STOPPED
[11/Jan/2013:16:04:57] ENGINE Bus EXITING
[11/Jan/2013:16:04:57] ENGINE Bus EXITED
Ben Davis
  • 617
  • 2
  • 11
  • 19
  • You could include the full traceback to avoid having us guess. My guess: the `sqlite3` library is not compiled, `sqlalchemy` only falls back to `pysqlite2` if `sqlite3` is not found. You need the `sqlite-dev` package or equivalent installed. – Martijn Pieters Jan 11 '13 at 16:00
  • Yes, you need to have sqlite development file installed when you compile python, otherwise sqlite3 will not be available. – Kien Truong Jan 11 '13 at 16:11
  • Okay that makes sense. So either I can install the `sqlite-dev` python package, or have sqlite installed when I compile? Can you elaborate on what you mean by sqlite development file? Thanks guys. – Ben Davis Jan 11 '13 at 16:22
  • Some linux distro separate libraries into header packages and library binary packages. The headers are only needed when you compile packages, hence they are not always installed. These header packages are often suffix with `-dev` or `-devel`. You should look for library with names like `sqlite-dev`, `libsqlite-dev` etc... These name varies from distro to distro. – Kien Truong Jan 11 '13 at 16:32
  • Okay, so does that mean that the library binaries for sqlite are already installed and I just need the headers so that those libraries can be used? I'm also going to have the problem that I don't have root. When compiling, what paths are used to try and locate the headers? – Ben Davis Jan 11 '13 at 16:41
  • 1
    For anyone else who may have a similar problem: [http://stackoverflow.com/questions/1462565/what-are-sqlite-development-headers-and-how-to-install-them](http://stackoverflow.com/questions/1462565/what-are-sqlite-development-headers-and-how-to-install-them) – Ben Davis Jan 11 '13 at 16:45
  • You should write an aswer to your own question and then accept it so everybody will know how to resolve the problem. Your comment is sufficent but let's keep things clean. – Wookie88 Jun 26 '13 at 10:17

1 Answers1

2

For anyone else who may have a similar problem: What are sqlite development headers and how to install them?

Community
  • 1
  • 1
Ben Davis
  • 617
  • 2
  • 11
  • 19