Installation » History » Version 47

Marcus Pearce, 2014-06-03 07:38 PM

1 47 Marcus Pearce
h1. Installing IDyOM and its prerequisites
2 1 Marcus Pearce
3 46 Marcus Pearce
{{>toc}}
4 1 Marcus Pearce
5 46 Marcus Pearce
h2. Summary
6 1 Marcus Pearce
7 47 Marcus Pearce
* Download "Steel Bank Common Lisp [SBCL]":http://www.sbcl.org/platform-table.html and "install it":http://www.sbcl.org/getting.html
8 46 Marcus Pearce
* Install Emacs ("see here for MacOS":http://emacsformacosx.com/)
9 47 Marcus Pearce
* Install "Quicklisp":http://www.quicklisp.org/beta/, a library manager for Common Lisp: download "<code>quicklisp.lisp</code>":http://beta.quicklisp.org/quicklisp.lisp and follow the instructions "here":http://www.quicklisp.org/beta/#installation
10 46 Marcus Pearce
* (Optional) Install an SQL database - I recommend  "SQLite":http://www.sqlite.org/ which is already installed on most recent flavours of MacOS and Linux. 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.
11 46 Marcus Pearce
* Install and setup the IDyOM code itself
12 1 Marcus Pearce
13 46 Marcus Pearce
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).
14 46 Marcus Pearce
15 46 Marcus Pearce
h2. Install SBCL
16 46 Marcus Pearce
17 46 Marcus Pearce
# download SBCL for MacOS X (the AMD64 version) here:
18 46 Marcus Pearce
19 46 Marcus Pearce
http://www.sbcl.org/platform-table.html
20 46 Marcus Pearce
21 46 Marcus Pearce
# on MacOS make sure you have the Xcode developer tools installed from the DVD that came with your Mac (required for GNU make)
22 46 Marcus Pearce
23 46 Marcus Pearce
# install SBCL by following the instructions here:
24 46 Marcus Pearce
25 46 Marcus Pearce
http://www.sbcl.org/getting.html
26 46 Marcus Pearce
27 46 Marcus Pearce
(Basically: unpack the downloaded tar.bz2 file, open a terminal window, 
28 1 Marcus Pearce
change directory ('cd') into the unpacked directory and type 'sudo sh 
29 1 Marcus Pearce
install.sh').
30 1 Marcus Pearce
31 47 Marcus Pearce
h2. Download and install Emacs
32 47 Marcus Pearce
33 47 Marcus Pearce
MacOS: Universal binaries available here: http://emacsformacosx.com/
34 47 Marcus Pearce
Linux: <code>sudo apt-get install emacs</code>
35 47 Marcus Pearce
36 1 Marcus Pearce
h2. Install Quicklisp
37 1 Marcus Pearce
38 47 Marcus Pearce
# make a new folder in your home directory called 'quicklisp'
39 1 Marcus Pearce
40 47 Marcus Pearce
# download the file http://beta.quicklisp.org/quicklisp.lisp and put it into the new folder
41 47 Marcus Pearce
42 47 Marcus Pearce
# open a terminal window and type 'sbcl' to start sbcl
43 47 Marcus Pearce
44 47 Marcus Pearce
# type each of the following lines followed by enter, changing the path to match the location of your quicklisp folder:
45 47 Marcus Pearce
46 1 Marcus Pearce
<pre>
47 47 Marcus Pearce
(load "/Users/marcusp/quicklisp/quicklisp.lisp")
48 47 Marcus Pearce
(quicklisp-quickstart:install :path "/Users/marcusp/quicklisp/")
49 1 Marcus Pearce
(ql:add-to-init-file)
50 1 Marcus Pearce
(ql:quickload "quicklisp-slime-helper")
51 47 Marcus Pearce
<pre>
52 1 Marcus Pearce
53 47 Marcus Pearce
# Remember to follow the instructions given by each of these commands, *in particular* the final command, which prints some lines of code to copy and paste into the emacs configuration file called <code>.emacs</code> in your home directory (you must create this file in Emacs or another text editor).
54 1 Marcus Pearce
55 47 Marcus Pearce
# open (or restart) Emacs, press Alt-x and type slime - you should now be running SBCL from within Emacs
56 1 Marcus Pearce
57 47 Marcus Pearce
h2. Download and install IDyOM
58 1 Marcus Pearce
59 47 Marcus Pearce
# download the latest version of IDyOM from: https://code.soundsoftware.ac.uk/projects/idyom-project
60 1 Marcus Pearce
61 47 Marcus Pearce
# unzip the zip file into the folder 'local-projects' within the 'quicklisp' folder (e.g., '/Users/marcusp/quicklisp/local-projects/')
62 1 Marcus Pearce
63 47 Marcus Pearce
# make a folder in your home directory called 'idyom'. Within that folder make two further folders, one called 'db', the other called 'data'. Within the 'data' folder make three further folders called 'cache', 'models' and 'resampling'.
64 1 Marcus Pearce
65 47 Marcus Pearce
# using Emacs or another text editor open the file called '.sbclrc' in your home directory and add the following lines to the end of the file (the file should already have some lisp code in it), changing the paths to match the location of the 'idyom' folder you created in step 3:
66 1 Marcus Pearce
67 47 Marcus Pearce
<pre>
68 47 Marcus Pearce
;;; Load CLSQL by default
69 47 Marcus Pearce
(ql:quickload "clsql")
70 1 Marcus Pearce
71 47 Marcus Pearce
;;; IDyOM
72 47 Marcus Pearce
(defun start-idyom ()
73 47 Marcus Pearce
   (defvar *idyom-root* "/Users/marcusp/idyom/")
74 47 Marcus Pearce
   (ql:quickload "idyom")
75 47 Marcus Pearce
   (clsql:connect '("/Users/marcusp/idyom/db/database-cents.sqlite") :if-exists :old :database-type :sqlite3))
76 47 Marcus Pearce
</pre>
77 1 Marcus Pearce
78 47 Marcus Pearce
# Restart Emacs, run Slime again (<code>Alt-x slime</code>) and type <code>(start-idyom)</code> at the prompt, <code>CL-USER></code>, to load IDyOM. The first time you run this, it will also download all the required third-party lisp libraries.
79 47 Marcus Pearce
80 47 Marcus Pearce
# The first time you run IDyOM, you must initialise the database by issuing the following command at the prompt (<code>CL-USER></code>):
81 47 Marcus Pearce
82 8 Jeremy Gow
<pre>
83 47 Marcus Pearce
(mtp-admin:initialise-database)
84 1 Marcus Pearce
</pre>
85 8 Jeremy Gow
86 47 Marcus Pearce
NB: if you run this command later it will delete all the contents of your database, so only run it once.
87 8 Jeremy Gow
88 47 Marcus Pearce
h1. Starting IDyOM
89 1 Marcus Pearce
90 47 Marcus Pearce
Having installed IDyOM as described above, you can start it by:
91 44 Marcus Pearce
92 47 Marcus Pearce
# starting Emacs
93 44 Marcus Pearce
94 47 Marcus Pearce
# typing <code>Alt-x slime</code>
95 44 Marcus Pearce
96 47 Marcus Pearce
# entering <code>(start-idyom)</code> at the Lisp prompt, <code>CL-USER></code>
97 44 Marcus Pearce
98 47 Marcus Pearce
h1. Troubleshooting
99 44 Marcus Pearce
100 47 Marcus Pearce
h2. Reinstalling
101 44 Marcus Pearce
102 47 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.
103 47 Marcus Pearce
104 47 Marcus Pearce
h2. Creating a database
105 47 Marcus Pearce
106 47 Marcus Pearce
You may use different kinds of databases. For example, to create an SQLite database called 'example.db' in directory <code>DIR</code>:
107 47 Marcus Pearce
108 44 Marcus Pearce
<pre>
109 44 Marcus Pearce
(clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3)
110 44 Marcus Pearce
</pre>
111 47 Marcus Pearce
112 44 Marcus Pearce
Alternatively, to connect to an existing local MySQL database:
113 47 Marcus Pearce
114 44 Marcus Pearce
<pre>
115 44 Marcus Pearce
(clsql:connect '("localhost" "example-database" "username" "password") :if-exists :old :database-type :mysql)
116 44 Marcus Pearce
</pre>
117 47 Marcus Pearce
118 44 Marcus Pearce
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.
119 44 Marcus Pearce
120 47 Marcus Pearce
h2. Problems loading foreign database libraries:
121 44 Marcus Pearce
122 44 Marcus Pearce
Depending on how your system is configured, <code>clsql:connect</code> may give a "Couldn't load foreign libraries" error.  In this case, you
123 44 Marcus Pearce
need to "tell CLSQL where it can find these libraries":http://clsql.b9.com/manual/appendix.html#foreignlibs, e.g.
124 47 Marcus Pearce
125 44 Marcus Pearce
<pre>
126 1 Marcus Pearce
(clsql:push-library-path "/usr/local/mysql/lib/")
127 1 Marcus Pearce
</pre>
128 1 Marcus Pearce
129 47 Marcus Pearce
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.