Installation » History » Version 27

« Previous - Version 27/85 (diff) - Next » - Current version
Marcus Pearce, 2013-04-13 02:48 AM


Installing IDyOM

Prerequisites

Many people find Emacs with Slime useful for Common Lisp development. Package management systems can simplify the installation of these prerequisites, e.g. Fink or Macports for OS X.

See the CLSQL Manual for information on other database systems you can use and how to access them from Common Lisp. If you prefer not to use Quicklisp, you will need to install the following Lisp libraries: UFFI, CLSQL, CL-PPCRE, PS-Graph, Midi

If you are a new user of Quicklisp and you have existing installations of any of these libraries, then you would do well to remove them and clear the corresponding ASDF entries from your .sbclrc file first.

Install Quicklisp

First download quicklisp.lisp to a directory DIR_A. You can then install Quicklisp to another directory of your choice DIR_B:

(load "/DIR_A/quicklisp.lisp")
(quicklisp-quickstart:install :path "/DIR_B/quicklisp/")
(ql:add-to-init-file)

Use the full pathnames for both directories (Lisp doesn't interpret shell substitutions like ~ for the home directory).

Download IDyOM

Download the following Lisp libraries, and unzip them into DIR/quicklisp/local-projects/

The local-projects directory should now contain six subdirectories, one for each library.

Set *idyom-root*

IDyOM requires the global variable *idyom-root* be set to a suitable working directory, where it can cache results etc. Additionally, you need to create three directories below *idyom-root* for IDyOM to use: *idyom-root*/data/cache/, data/models/ and data/resampling/.

One way to ensure *idyom-root* always points to the correct directory is to include the following in your .sbclrc file, located in your home directory, and then restart SBCL:

(defvar *idyom-root* "PATH/TO/WORKING/DIR/")

Install IDyOM

You can now use Quicklisp to install IDyOM:

(ql:quickload "idyom")

This will also install the third-party Lisp libraries IDyOM depends on. The first time it loads, you may get an error which brings up the debugger. Press 2 [ACCEPT] and the installation should complete.

Create a database

IDyOM is now installed, but you will need a database in order to use it. To create an SQLite database in directory DIR:

(clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3)

Alternatively, to connect to an existing local MySQL database:
(clsql:connect '("localhost" "example-database" "username" "password") :if-exists :old :database-type :mysql)

See the CLSQL documentation for more on connect and supported databases.

Finally, for a new database:

(mtp-admin:initialise-database)

You may now proceed to the tutorial.

Problems loading foreign libraries

Depending on how your system is configured, clsql:connect may give a "Couldn't load foreign libraries" error. In this case, you
need to tell CLSQL where it can find these libraries, e.g.

(clsql:push-library-path "/usr/local/mysql/lib/")

The exact path will depend on your system. Note that, for some database installations these libraries may not have been installed, and you should consult the database documentation.

Create a startup script [optional]

Every time you start IDyOM, you will need to connect to the database. You may find it easier to combine all the startup commands in a single script, e.g.

(ql:quickload "idyom")
(clsql:push-library-path "/usr/local/mysql/lib/")
(defun connect-example ()
  (clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3))
(connect-example)