Home > Software design >  problems installing sqlite and python on freebsd
problems installing sqlite and python on freebsd

Time:09-27

This is driving me crazy! Any help you can provide will be most welcome!

I have a python3/sqlite application (running in a virtual environment) that is working fine on debian. I need to install it on freebsd (running in a virtual environment). I have installed python3 and sqlite (I can open a .sqlite file from the command line).

When I try to run the python script, I get the following error:

(venv) [jordan@webServer ~/crons/powerwall]$ python3 main.py
Traceback (most recent call last):
  File "/usr/home/jordan/crons/powerwall/main.py", line 78, in <module>
    run()
  File "/usr/home/jordan/crons/powerwall/main.py", line 33, in run
    database.load_db(config_mgr=config)
  File "/usr/home/jordan/crons/powerwall/database.py", line 108, in load_db
    db = PowerWallDb(cfg_mgr=config_mgr)
  File "/usr/home/jordan/crons/powerwall/database.py", line 94, in __init__
    super().__init__(cfg_mgr=cfg_mgr, section=section)
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/thompcoutils/db_utils.py", line 77, in __init__
    self._connect_sqlite(self.sqlite_file, check_same_thread=False)
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/thompcoutils/db_utils.py", line 99, in _connect_sqlite
    self._connect_uri(uri, **kwargs)
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/thompcoutils/db_utils.py", line 95, in _connect_uri
    self.connection = sqlobject.sqlhub.processConnection = sqlobject.connectionForURI(uri, **kwargs)
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/sqlobject/dbconnection.py", line 1105, in connectionForURI
    conn = connCls.connectionFromURI(uri)
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/sqlobject/dbconnection.py", line 154, in connectionFromURI
    return cls._connectionFromParams(*cls._parseURI(uri))
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/sqlobject/sqlite/sqliteconnection.py", line 122, in _connectionFromParams
    return cls(filename=path, **args)
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/sqlobject/sqlite/sqliteconnection.py", line 64, in __init__
    raise ImportError(
ImportError: Cannot find an SQLite driver, tried supersqlite,pysqlite2,sqlite3,sqlite
Exception ignored in: <function DBAPI.__del__ at 0x8029c1310>
Traceback (most recent call last):
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/sqlobject/dbconnection.py", line 704, in __del__
    self.close()
  File "/usr/home/jordan/crons/powerwall/venv/lib/python3.9/site-packages/sqlobject/sqlite/sqliteconnection.py", line 217, in close
    if self._memory:
AttributeError: 'SQLiteConnection' object has no attribute '_memory'

CodePudding user response:

You have to install py-sqlite3 which is the "Standard Python binding to the SQLite3 library"

Install From Ports:

cd /usr/ports/databases/py-sqlite3/ && make install clean

Install From pkg:

pkg install databases/py-sqlite3

CodePudding user response:

Basically, it looks like the standard Python bindings for SQLite is a separate package on FreeBSD (perhaps, on all *nix/*BSD). So, in general, there are three components, which you need, Python, SQLite (this one may not be actually necessary for Python) AND the standard Python bindings for SQLite. I have not worked with FreeBSD, but based on Googling, have you tried installing this https://pkgs.org/download/py39-sqlite3 maybe?

  • Related