Installation » History » Version 42

Marcus Pearce, 2013-10-30 10:32 AM

1 7 Jeremy Gow
h1. Installing IDyOM
2 1 Marcus Pearce
3 1 Marcus Pearce
h2. Prerequisites
4 1 Marcus Pearce
5 2 Marcus Pearce
* "Steel Bank Common Lisp [SBCL]":http://www.sbcl.org/platform-table.html
6 39 Marcus Pearce
* "Quicklisp":http://www.quicklisp.org/beta/ is a library manager for Common Lisp.  Just download "<code>quicklisp.lisp</code>":http://beta.quicklisp.org/quicklisp.lisp and follow the instructions "here":http://www.quicklisp.org/beta/
7 39 Marcus Pearce
* An SQL database.  I would recommend  "SQLite":http://www.sqlite.org/ which is already installed on most recent flavours of MacOS and Linux.
8 7 Jeremy Gow
9 39 Marcus Pearce
It is possible to use SBCL in a terminal window but I strongly suggest using "Emacs":http://www.gnu.org/software/emacs/ and installing Slime (a Lisp interface for Emacs) which is easily done using Quicklisp (see instructions "here":http://www.quicklisp.org/beta/).
10 7 Jeremy Gow
11 39 Marcus Pearce
See the "CLSQL Manual":http://clsql.b9.com/manual/ for information on other database systems you can use and how to access them from Common Lisp.
12 27 Marcus Pearce
13 7 Jeremy Gow
h2. Install Quicklisp
14 1 Marcus Pearce
15 22 Jeremy Gow
First download  "<code>quicklisp.lisp</code>":http://beta.quicklisp.org/quicklisp.lisp to a directory <code>DIR_A</code>.  You can then install Quicklisp to another directory of your choice <code>DIR_B</code>:
16 1 Marcus Pearce
17 1 Marcus Pearce
<pre>
18 22 Jeremy Gow
(load "/DIR_A/quicklisp.lisp")
19 22 Jeremy Gow
(quicklisp-quickstart:install :path "/DIR_B/quicklisp/")
20 1 Marcus Pearce
(ql:add-to-init-file)
21 40 Marcus Pearce
(ql:quickload "quicklisp-slime-helper")
22 1 Marcus Pearce
</pre>
23 22 Jeremy Gow
24 26 Marcus Pearce
Use the full pathnames for both directories (Lisp doesn't interpret shell substitutions like ~ for the home directory).
25 40 Marcus Pearce
26 40 Marcus Pearce
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 <code>.emacs</code> in your home directory). 
27 1 Marcus Pearce
28 32 Marcus Pearce
See the "Quicklisp website":http://beta.quicklisp.org/ for documentation about other features of Quicklisp.
29 32 Marcus Pearce
30 7 Jeremy Gow
h2. Download IDyOM
31 1 Marcus Pearce
32 42 Marcus Pearce
Download the IDyOM software, and unzip it into <code>DIR_B/quicklisp/local-projects/</code>
33 1 Marcus Pearce
34 36 Marcus Pearce
* "idyom":https://code.soundsoftware.ac.uk/hg/idyom/archive/tip.zip
35 9 Jeremy Gow
36 42 Marcus Pearce
*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 <code>asdf:*central-registry*</code> in your .sbclrc file, should any exist.
37 34 Marcus Pearce
38 12 Jeremy Gow
h2. Set <code>*idyom-root*</code>
39 1 Marcus Pearce
40 28 Marcus Pearce
IDyOM requires the global variable <code>*idyom-root*</code> 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 <code>*idyom-root*</code> to point to the desired directory by including the following in your <code>.sbclrc</code> file, located in your home directory (you must restart SBCL for this to take effect):
41 21 Jeremy Gow
42 1 Marcus Pearce
<pre>
43 29 Marcus Pearce
(defvar *idyom-root* "/FULL/PATH/TO/WORKING/DIR/")
44 1 Marcus Pearce
</pre>
45 28 Marcus Pearce
46 10 Jeremy Gow
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 <code>*idyom-root*</code> for IDyOM to use: <code>*idyom-root*/data/cache/</code>, <code>data/models/</code> and <code>data/resampling/</code>.
47 16 Jeremy Gow
48 1 Marcus Pearce
h2. Install IDyOM
49 7 Jeremy Gow
50 9 Jeremy Gow
You can now use Quicklisp to install IDyOM:
51 31 Marcus Pearce
52 5 Marcus Pearce
<pre>
53 7 Jeremy Gow
(ql:quickload "idyom")
54 1 Marcus Pearce
</pre>
55 31 Marcus Pearce
56 31 Marcus Pearce
This will also install the third-party Lisp libraries IDyOM depends on.  
57 31 Marcus Pearce
58 31 Marcus Pearce
(If you get an error which brings up the debugger, press 2 [ACCEPT] and the installation should complete.)
59 1 Marcus Pearce
60 7 Jeremy Gow
h2. Create a database
61 1 Marcus Pearce
62 30 Marcus Pearce
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 <code>DIR</code>:
63 5 Marcus Pearce
64 1 Marcus Pearce
<pre>
65 1 Marcus Pearce
(clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3)
66 8 Jeremy Gow
</pre>
67 8 Jeremy Gow
Alternatively, to connect to an existing local MySQL database:
68 8 Jeremy Gow
<pre>
69 8 Jeremy Gow
(clsql:connect '("localhost" "example-database" "username" "password") :if-exists :old :database-type :mysql)
70 8 Jeremy Gow
</pre>
71 8 Jeremy Gow
See the "CLSQL documentation":http://clsql.b9.com/manual/ for more on "connect":http://clsql.b9.com/manual/connect.html and "supported databases":http://clsql.b9.com/manual/prerequisites.html#idp8251808.
72 8 Jeremy Gow
73 8 Jeremy Gow
Finally, for a new database: 
74 8 Jeremy Gow
<pre>
75 7 Jeremy Gow
(mtp-admin:initialise-database)
76 7 Jeremy Gow
</pre>
77 1 Marcus Pearce
78 8 Jeremy Gow
79 8 Jeremy Gow
h3. Problems loading foreign libraries
80 8 Jeremy Gow
81 8 Jeremy Gow
Depending on how your system is configured, <code>clsql:connect</code> may give a "Couldn't load foreign libraries" error.  In this case, you
82 8 Jeremy Gow
need to "tell CLSQL where it can find these libraries":http://clsql.b9.com/manual/appendix.html#foreignlibs, e.g.
83 8 Jeremy Gow
<pre>
84 8 Jeremy Gow
(clsql:push-library-path "/usr/local/mysql/lib/")
85 8 Jeremy Gow
</pre>
86 9 Jeremy Gow
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.