Installation » History » Version 34

Marcus Pearce, 2013-04-26 04:22 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 7 Jeremy Gow
* "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
7 7 Jeremy Gow
* An SQL database.  I would recommend  "SQLite":http://www.sqlite.org/ 
8 1 Marcus Pearce
9 7 Jeremy Gow
Many people find "Emacs":http://www.gnu.org/software/emacs/ with "Slime":http://common-lisp.net/project/slime/ useful for Common Lisp development.  Package management systems can simplify the installation of these prerequisites, e.g. "Fink":http://www.finkproject.org/ or "Macports":http://www.macports.org/ for OS X.
10 2 Marcus Pearce
11 7 Jeremy Gow
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.  If you prefer not to use Quicklisp, you will need to install the following Lisp libraries: "UFFI":http://uffi.bi.com, "CLSQL":http://clsql.b9.com, "CL-PPCRE":http://www.weitz.de/cl-ppcre/, "PS-Graph":http://www.cliki.net/psgraph, "Midi":http://www.cliki.net/midi
12 1 Marcus Pearce
13 27 Marcus Pearce
14 7 Jeremy Gow
h2. Install Quicklisp
15 1 Marcus Pearce
16 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>:
17 1 Marcus Pearce
18 1 Marcus Pearce
<pre>
19 22 Jeremy Gow
(load "/DIR_A/quicklisp.lisp")
20 22 Jeremy Gow
(quicklisp-quickstart:install :path "/DIR_B/quicklisp/")
21 1 Marcus Pearce
(ql:add-to-init-file)
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 1 Marcus Pearce
26 32 Marcus Pearce
See the "Quicklisp website":http://beta.quicklisp.org/ for documentation about other features of Quicklisp.
27 32 Marcus Pearce
28 7 Jeremy Gow
h2. Download IDyOM
29 1 Marcus Pearce
30 9 Jeremy Gow
Download the following Lisp libraries, and unzip them into <code>DIR/quicklisp/local-projects/</code>
31 19 Jeremy Gow
* "idyom":https://code.soundsoftware.ac.uk/hg/idyom/archive/stable.zip
32 1 Marcus Pearce
* "AMuSE":https://code.soundsoftware.ac.uk/hg/amuse/archive/tip.zip
33 1 Marcus Pearce
* "amuse-viewpoints":https://code.soundsoftware.ac.uk/hg/amuse-viewpoints/archive/tip.zip
34 19 Jeremy Gow
* "MIPS":https://code.soundsoftware.ac.uk/hg/mips/archive/tip.zip
35 1 Marcus Pearce
* "mtp-admin":https://code.soundsoftware.ac.uk/hg/mtp-admin/archive/tip.zip
36 1 Marcus Pearce
* "ppm-star":https://code.soundsoftware.ac.uk/hg/ppm-star/archive/tip.zip
37 1 Marcus Pearce
38 9 Jeremy Gow
The <code>local-projects</code> directory should now contain six subdirectories, one for each library.
39 9 Jeremy Gow
40 34 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.
41 34 Marcus Pearce
 
42 34 Marcus Pearce
43 12 Jeremy Gow
h2. Set <code>*idyom-root*</code>
44 1 Marcus Pearce
45 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):
46 21 Jeremy Gow
47 1 Marcus Pearce
<pre>
48 29 Marcus Pearce
(defvar *idyom-root* "/FULL/PATH/TO/WORKING/DIR/")
49 1 Marcus Pearce
</pre>
50 28 Marcus Pearce
51 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>.
52 16 Jeremy Gow
53 1 Marcus Pearce
h2. Install IDyOM
54 7 Jeremy Gow
55 9 Jeremy Gow
You can now use Quicklisp to install IDyOM:
56 31 Marcus Pearce
57 5 Marcus Pearce
<pre>
58 7 Jeremy Gow
(ql:quickload "idyom")
59 1 Marcus Pearce
</pre>
60 31 Marcus Pearce
61 31 Marcus Pearce
This will also install the third-party Lisp libraries IDyOM depends on.  
62 31 Marcus Pearce
63 31 Marcus Pearce
(If you get an error which brings up the debugger, press 2 [ACCEPT] and the installation should complete.)
64 1 Marcus Pearce
65 7 Jeremy Gow
h2. Create a database
66 1 Marcus Pearce
67 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>:
68 5 Marcus Pearce
69 1 Marcus Pearce
<pre>
70 1 Marcus Pearce
(clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3)
71 8 Jeremy Gow
</pre>
72 8 Jeremy Gow
Alternatively, to connect to an existing local MySQL database:
73 8 Jeremy Gow
<pre>
74 8 Jeremy Gow
(clsql:connect '("localhost" "example-database" "username" "password") :if-exists :old :database-type :mysql)
75 8 Jeremy Gow
</pre>
76 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.
77 8 Jeremy Gow
78 8 Jeremy Gow
Finally, for a new database: 
79 8 Jeremy Gow
<pre>
80 7 Jeremy Gow
(mtp-admin:initialise-database)
81 7 Jeremy Gow
</pre>
82 1 Marcus Pearce
83 1 Marcus Pearce
You may now proceed to the [[tutorial]].
84 8 Jeremy Gow
85 8 Jeremy Gow
h3. Problems loading foreign libraries
86 8 Jeremy Gow
87 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
88 8 Jeremy Gow
need to "tell CLSQL where it can find these libraries":http://clsql.b9.com/manual/appendix.html#foreignlibs, e.g.
89 8 Jeremy Gow
<pre>
90 8 Jeremy Gow
(clsql:push-library-path "/usr/local/mysql/lib/")
91 8 Jeremy Gow
</pre>
92 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.
93 10 Jeremy Gow
94 1 Marcus Pearce
h2. Create a startup script [optional]
95 1 Marcus Pearce
96 11 Jeremy Gow
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.
97 11 Jeremy Gow
98 11 Jeremy Gow
<pre>
99 11 Jeremy Gow
(ql:quickload "idyom")
100 11 Jeremy Gow
(clsql:push-library-path "/usr/local/mysql/lib/")
101 15 Jeremy Gow
(defun connect-example ()
102 1 Marcus Pearce
  (clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3))
103 18 Jeremy Gow
(connect-example)
104 11 Jeremy Gow
</pre>