Installation » History » Version 46
« Previous -
Version 46/85
(diff) -
Next » -
Current version
Marcus Pearce, 2014-06-03 07:13 PM
Installing and Loading IDyOM¶
Summary¶
- Download Steel Bank Common Lisp [SBCL] and install
- Install Emacs (see here for MacOS)
- Install Quicklisp, a library manager for Common Lisp: download
quicklisp.lisp
and follow the instructions here - (Optional) Install an SQL database - I recommend SQLite which is already installed on most recent flavours of MacOS and Linux. See the CLSQL Manual for information on other database systems you can use and how to access them from Common Lisp.
- Install and setup the IDyOM code itself
The following is a description of each of these steps tested on MacOS 10.7.5 and Ubuntu 14.04 (GNU/Linux 3.13.0-24-generic x86_64).
Install SBCL¶
- download SBCL for MacOS X (the AMD64 version) here:
http://www.sbcl.org/platform-table.html
- on MacOS make sure you have the Xcode developer tools installed from the DVD that came with your Mac (required for GNU make)
- install SBCL by following the instructions here:
http://www.sbcl.org/getting.html
(Basically: unpack the downloaded tar.bz2 file, open a terminal window,
change directory ('cd') into the unpacked directory and type 'sudo sh
install.sh').
Install Quicklisp¶
First download quicklisp.lisp
to a directory DIR_A
. Then start SBCL by typing sbcl
in a terminal window and 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) (ql:quickload "quicklisp-slime-helper")
Use the full pathnames for both directories (when run in the terminal, SBCL doesn't interpret shell substitutions like ~ for the home directory).
Remember to follow the instructions given by each of these commands (in particular the final command includes some lines of code to put in the emacs configuration file - usually called .emacs
in your home directory).
See the Quicklisp website for documentation about other features of Quicklisp.
Download IDyOM¶
Download the IDyOM software, and unzip it into DIR_B/quicklisp/local-projects/
Removing previous installations: If you have any previous installations of these libraries, you would do well to remove them, especially if they are in folders such as '~/.local' which are automatically scanned by asdf/quicklisp. You may also want to clear the corresponding entries from asdf:*central-registry*
in your .sbclrc file, should any exist.
Set *idyom-root*
¶
IDyOM requires the global variable *idyom-root*
be set to a suitable working directory, where it stores models, cross-validation settings, cached results etc. By default, this is a directory called 'idyom' in your home directory. Alternatively, you can customise the location by setting the variable *idyom-root*
to point to the desired directory by including the following in your .sbclrc
file, located in your home directory (you must restart SBCL for this to take effect):
(defvar *idyom-root* "/FULL/PATH/TO/WORKING/DIR/")
However you configure this, you must ensure that the directory exists (create it if it doesn't) and you will also need to create three directories below *idyom-root*
for IDyOM to use: *idyom-root*/data/cache/
, data/models/
and data/resampling/
.
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.
(If you 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. For example, to create an SQLite database called 'example.db' 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)
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.
Starting IDyOM¶
Having installed IDyOM, you can load the system by running Common Lisp and using quickload
:
(ql:quickload "idyom")
You then need to reconnect to your database. For example, if you have an SQLite database located at DIR/example.db then:
(clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3)
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 and put them in the SBCL configuration file .sbclrc
in your home directory. Here is my complete .sbclrc
file:
;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) ;;; Load CLSQL by default (ql:quickload "clsql") ;;; IDyOM (defun start-idyom () (defvar *idyom-root* "/Users/marcusp/idyom/") (ql:quickload "idyom") (clsql:connect '("/Users/marcusp/idyom/db/database-cents.sqlite") :if-exists :old :database-type :sqlite3))
You will need to change the path and filenames. Then after starting Emacs and SBCL, you can just run (start-idyom)
to load IDyOM and connect to the database.