Installation » History » Version 61

« Previous - Version 61/85 (diff) - Next » - Current version
Marcus Pearce, 2014-06-04 04:09 PM


Installing IDyOM and its prerequisites

Summary

  1. Download Steel Bank Common Lisp [SBCL] and install it
  2. Install Emacs (available here for MacOS)
  3. Install Quicklisp, a library manager for Common Lisp (download quicklisp.lisp and follow the instructions here)
  4. (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.
  5. Install and setup the IDyOM code itself

The following is a detailed 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). It has been successfully installed on Windows following the same basic steps but I don't have a Windows machine to test the detailed instructions.

1. Install SBCL

  1. download SBCL for MacOS X (the AMD64 version) here: http://www.sbcl.org/platform-table.html
  2. on MacOS make sure you have the Xcode developer tools installed from the DVD that came with your Mac (required for GNU make)
  3. 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).

2. Download and install Emacs

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

3. Install Quicklisp

  1. make a new folder in your home directory called 'quicklisp'
  2. download the file http://beta.quicklisp.org/quicklisp.lisp and put it into the new folder
  3. open a terminal window and type 'sbcl' to start sbcl
  4. type each of the following lines followed by enter, changing the path to match the location of your quicklisp folder:
    (load "/Users/marcusp/quicklisp/quicklisp.lisp")
    (quicklisp-quickstart:install :path "/Users/marcusp/quicklisp/")
    (ql:add-to-init-file)
    (ql:quickload "quicklisp-slime-helper")
    
  5. 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 .emacs in your home directory (you must create this file in Emacs or another text editor).
  6. open (or restart) Emacs, press Alt-x and type slime - you should now be running SBCL from within Emacs

4. Install an SQL database

MacOS: No action required, Sqlite is already installed (unless you prefer a different database system, see below).
Linux: sudo apt-get install sqlite

5. Install IDyOM

  1. download the latest version of IDyOM from: https://code.soundsoftware.ac.uk/hg/idyom/archive/tip.zip
  2. unzip the zip file into the folder 'local-projects' within the 'quicklisp' folder (e.g., '/Users/marcusp/quicklisp/local-projects/')
  3. 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'.
  4. 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:
    ;;; 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))
    
  5. Restart Emacs, run Slime again (Alt-x slime) and type (start-idyom) at the prompt, CL-USER>, to load IDyOM. The first time you run this, it will also download all the required third-party lisp libraries.
  6. The first time you run IDyOM, you must initialise the database by issuing the following command at the prompt (CL-USER>):
    (mtp-admin:initialise-database)
    

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

Starting IDyOM

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

  1. launching Emacs
  2. typing Alt-x slime
  3. entering (start-idyom) at the Lisp prompt, CL-USER>

Troubleshooting

The lisp debugger

If you find yourself with something like this:

* (/ 1 0)

debugger invoked on a DIVISION-BY-ZERO:
  arithmetic error DIVISION-BY-ZERO signalled
Operation was SB-KERNEL::DIVISION, operands (1 0).

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-KERNEL::INTEGER-/-INTEGER 1 0)
0] 

Then you have typed something that lisp doesn't like. Be sure to read the information and the restart options and enter the appropriate restart number - usually this is the one labelled [ABORT] but, depending on the situation, [CONTINUE] may also be useful.

Reinstalling IDyOM

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.

Using different SQL database systems

You may use different kinds of databases. 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.

Problems loading foreign database 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.