Install Virtuoso 6.1.6 for use with Python 3 on LinuxMint 18

Install the following from the Software Manager (use apt if you prefer):

Virtuoso-opensource
Virtuoso-server
Virtuoso-vad-conductor
Virtuoso-vad-isparql
Virtuoso-vsp-startpage
Virtuoso-opensource-6.1
Virtuoso-opensource-6.1-bin
Virtuoso-opensource-61-common
Unixodbc
Libvirtodbc0

Download zip and Install PyODBC from

https://github.com/maparent/pyodbc/tree/v3-virtuoso

Unzip, cd into the expended folder, then type:

$ sudo python setup.py build install

Add the following in the odbc.ini:

$ sudo nano /etc/odbc.ini

Add the following and save it.

[Local Virtuoso]
Driver = /usr/lib/odbc/virtodbc_r.so
Address = localhost:1111

Start the database:

$ cd /etc/virtuoso-opensource-6.1
$ sudo virtuoso-t -fd

If you have problems delete virtuoso.lck:

$ sudo rm -r /var/lib/virtuoso-opensource-6.1/db/virtuoso.lck

Open the browser and point to: http://localhost:8890/conductor/

If this works, you’re good.

Assuming you haven’t changed them:
User = dba
Pass = dba

If you have trouble with the password, kill the db process, delete the db, and restart:

$ sudo rm -r /var/lib/virtuoso-opensource-6.1

The db ini is in: /etc/lib/virtuoso-opensource-6.1/virtuoso.ini

Console management:

$ isql-vt

Example Python3 code:

import decimal
import pyodbc

c = pyodbc.connect('DSN=Local Virtuoso;UID=dba;PWD=dba')

cursor = c.cursor()
print ([i for i in cursor.tables()])