Installation » History » Version 47

Version 46 (Marcus Pearce, 2014-06-03 07:13 PM) → Version 47/85 (Marcus Pearce, 2014-06-03 07:38 PM)

h1. Installing and Loading IDyOM and its prerequisites

{{>toc}}

h2. Summary

* Download "Steel Bank Common Lisp [SBCL]":http://www.sbcl.org/platform-table.html and "install it":http://www.sbcl.org/getting.html "install":http://www.sbcl.org/getting.html
* Install Emacs ("see here for MacOS":http://emacsformacosx.com/)
* 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 &quot;here&quot;:http://www.quicklisp.org/beta/
* (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.
* 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).

h2. 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').

h2. Download and install Emacs

MacOS: Universal binaries available here: http://emacsformacosx.com/
Linux: <code>sudo apt-get install emacs</code>

h2.
Install Quicklisp

# make First download &quot;&lt;code&gt;quicklisp.lisp&lt;/code&gt;&quot;:http://beta.quicklisp.org/quicklisp.lisp to a new folder directory &lt;code&gt;DIR_A&lt;/code&gt;. Then start SBCL by typing &lt;code&gt;sbcl&lt;/code&gt; in your home directory called 'quicklisp'

# download the file http://beta.quicklisp.org/quicklisp.lisp and put it into the new folder

# open
a terminal window and type 'sbcl' install Quicklisp to start sbcl

# type each
another directory of the following lines followed by enter, changing the path to match the location of your quicklisp folder: choice &lt;code&gt;DIR_B&lt;/code&gt;:

<pre>
(load "/Users/marcusp/quicklisp/quicklisp.lisp") &quot;/DIR_A/quicklisp.lisp&quot;)
(quicklisp-quickstart:install :path "/Users/marcusp/quicklisp/") &quot;/DIR_B/quicklisp/&quot;)
(ql:add-to-init-file)
(ql:quickload "quicklisp-slime-helper")
<pre> &lt;/pre&gt;

# Use the full pathnames for both directories (when run in the terminal, SBCL doesn&#x27;t interpret shell substitutions like ~ for the home directory).

Remember to follow the instructions given by each of these commands, *in particular* commands (in particular the final command, which prints command includes some lines of code to copy and paste into put in the emacs configuration file - usually called <code>.emacs</code> in your home directory (you must create this file in Emacs or another text editor). directory).

See the &quot;Quicklisp website&quot;:http://beta.quicklisp.org/ for documentation about other features of Quicklisp.


# open (or restart) Emacs, press Alt-x and type slime - you should now be running SBCL from within Emacs

h2. Download and install IDyOM

# download Download the latest version of IDyOM from: https://code.soundsoftware.ac.uk/projects/idyom-project

#
software, and unzip the zip file it into the folder 'local-projects' within the 'quicklisp' folder (e.g., '/Users/marcusp/quicklisp/local-projects/') &lt;code&gt;DIR_B/quicklisp/local-projects/&lt;/code&gt;

# 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'. * &quot;idyom&quot;:https://code.soundsoftware.ac.uk/hg/idyom/archive/tip.zip

# 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:

<pre>
;;; 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))
</pre>

# 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.

# The first time you run IDyOM, you must initialise the database by issuing the following command at the prompt (<code>CL-USER></code>):

<pre>
(mtp-admin:initialise-database)
</pre>

NB: if you run this command later it will delete all the contents of your database, so only run it once.

h1. Starting IDyOM

Having installed IDyOM as described above, you can start it by:

# starting Emacs

# typing <code>Alt-x slime</code>

# entering <code>(start-idyom)</code> at the Lisp prompt, <code>CL-USER></code>

h1. Troubleshooting

h2. Reinstalling

*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.

h2. Creating Set &lt;code&gt;*idyom-root*&lt;/code&gt;

IDyOM requires the global variable &lt;code&gt;*idyom-root*&lt;/code&gt; be set to
a database suitable working directory, where it stores models, cross-validation settings, cached results etc. By default, this is a directory called &#x27;idyom&#x27; in your home directory. Alternatively, you can customise the location by setting the variable &lt;code&gt;*idyom-root*&lt;/code&gt; to point to the desired directory by including the following in your &lt;code&gt;.sbclrc&lt;/code&gt; file, located in your home directory (you must restart SBCL for this to take effect):

&lt;pre&gt;
(defvar *idyom-root* &quot;/FULL/PATH/TO/WORKING/DIR/&quot;)
&lt;/pre&gt;

However you configure this, you must ensure that the directory exists (create it if it doesn&#x27;t) and you will also need to create three directories below &lt;code&gt;*idyom-root*&lt;/code&gt; for IDyOM to use: &lt;code&gt;*idyom-root*/data/cache/&lt;/code&gt;, &lt;code&gt;data/models/&lt;/code&gt; and &lt;code&gt;data/resampling/&lt;/code&gt;.

h2. Install IDyOM

You may can now use different kinds of databases. Quicklisp to install IDyOM:

&lt;pre&gt;
(ql:quickload &quot;idyom&quot;)
&lt;/pre&gt;

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.)

h2. 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 <code>DIR</code>:

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


Alternatively, to connect to an existing local MySQL database:


<pre>
(clsql:connect '("localhost" "example-database" "username" "password") :if-exists :old :database-type :mysql)
</pre>


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.

h2. Finally, for a new database:
&lt;pre&gt;
(mtp-admin:initialise-database)
&lt;/pre&gt;

h3.
Problems loading foreign database libraries: libraries

Depending on how your system is configured, <code>clsql:connect</code> may give a "Couldn't load foreign libraries" error. In this case, you
need to "tell CLSQL where it can find these libraries":http://clsql.b9.com/manual/appendix.html#foreignlibs, e.g.


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


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.

h1. Starting IDyOM

Having [[Installation|installed IDyOM]], you can load the system by running Common Lisp and using &lt;code&gt;quickload&lt;/code&gt;:

&lt;pre&gt;
(ql:quickload &quot;idyom&quot;)
&lt;/pre&gt;
You then need to reconnect to your database. For example, if you have an SQLite database located at DIR/example.db then:
&lt;pre&gt;
(clsql:connect &#x27;(&quot;DIR/example.db&quot;) :if-exists :old :database-type :sqlite3)
&lt;/pre&gt;

h2. 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 &lt;code&gt;.sbclrc&lt;/code&gt; in your home directory. Here is my complete &lt;code&gt;.sbclrc&lt;/code&gt; file:

&lt;pre&gt;
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames &quot;quicklisp/setup.lisp&quot;
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))

;;; Load CLSQL by default
(ql:quickload &quot;clsql&quot;)

;;; IDyOM
(defun start-idyom ()
(defvar *idyom-root* &quot;/Users/marcusp/idyom/&quot;)
(ql:quickload &quot;idyom&quot;)
(clsql:connect &#x27;(&quot;/Users/marcusp/idyom/db/database-cents.sqlite&quot;) :if-exists :old :database-type :sqlite3))
&lt;/pre&gt;

You will need to change the path and filenames. Then after starting Emacs and SBCL, you can just run &lt;code&gt;(start-idyom)&lt;/code&gt; to load IDyOM and connect to the database.