Aug 122012
 

I’m playing around with one of my other domains, RabbitTales.com, and seeing if I might be able to turn it into something useful.

One of the core technologies I’m investigating is the use of a REALLY cools site for those who like to read, OpenLibrary.org.  In finding my way around it I decided to try to get a developer instance of the software running.  However, it currently is only supported on Ubuntu 10.04 or 10.10.  Given that those are getting a little long in the tooth, I decided to see if I can get it running on Ubuntu 12.04.  It appears that I have had some success although the testing has been limited to getting the site up and running.  I haven’t tried to do much to it.

The only gotcha that I have found so far is that Python 2.7 supplies the “importlib” module and the OpenLibraries bundle also provides an implementation which causes a conflict.  Once found a workaround is fairly simple and follows.

Following the instructions at http://code.openlibrary.org/bootstrap.html on Ubuntu 12.04.

$ git clone git://github.com/internetarchive/openlibrary.git
$ cd openlibrary
$ sudo ./scripts/install_dependencies.sh

Here is where the fun begins.  The following will fail:

$ make bootstrap
** setting up virtualenv **
mkdir -p var/cache/pip
virtualenv --no-site-packages env
The --no-site-packages flag is deprecated; it is now the default behavior.
New python executable in env/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
./env/bin/pip install --download-cache var/cache/pip http://www.archive.org/download/ol_vendor/openlibrary.pybundle
Downloading/unpacking http://www.archive.org/download/ol_vendor/openlibrary.pybundle
Downloading openlibrary.pybundle (25.5Mb): 25.5Mb downloaded
Storing download in cache at ./var/cache/pip/http%3A%2F%2Fwww.archive.org%2Fdownload%2Fol_vendor%2Fopenlibrary.pybundle
Downloading/unpacking Sphinx
Running setup.py egg_info for package Sphinx
no previously-included directories found matching 'doc/_build'
Downloading/unpacking Pygments
Running setup.py egg_info for package Pygments
Downloading/unpacking kombu
Running setup.py egg_info for package kombu
Downloading/unpacking Genshi
Running setup.py egg_info for package Genshi
warning: no previously-included files found matching 'doc/2000ft.graffle'
warning: no previously-included files matching '*' found under directory 'doc/logo.lineform'
Downloading/unpacking Babel
Running setup.py egg_info for package Babel
Downloading/unpacking py
Running setup.py egg_info for package py
Downloading/unpacking python-dateutil
Running setup.py egg_info for package python-dateutil
Downloading/unpacking importlib
Running setup.py egg_info for package importlib
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/viz/src/openlibrary/env/build/importlib/setup.py", line 6, in <module>
raise Exception("importlib is included in Python 2.7 and newer for 2.x")
Exception: importlib is included in Python 2.7 and newer for 2.x
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 14, in <module>

File "/home/viz/src/openlibrary/env/build/importlib/setup.py", line 6, in <module>

raise Exception("importlib is included in Python 2.7 and newer for 2.x")

Exception: importlib is included in Python 2.7 and newer for 2.x

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/viz/src/openlibrary/env/build/importlib
Storing complete log in /home/viz/.pip/pip.log
make: *** [venv] Error 1
$

Now some surgery is required.  Make sure you path includes the env/bin directory from the build.  In my case, this is /home/viz/src/openlibrary/env/bin/.

$ export PATH=`pwd`/env/bin:${PATH}

Now we need to remove the importlib from the python build and complete the building of venv.  Basically, we are in the middle of the ‘make venv’ build step that is documented on the web page above.

$ virtualenv --no-site-packages env
$ env/bin/pip install var/cache/pip/http%3A%2F%2Fwww.archive.org%2Fdownload%2Fol_vendor%2Fopenlibrary.pybundle
$ rm -rf env/build/importlib/
$ env/bin/pip install env/build/*
$ make install_solr
$ make setup_coverstore
$ make setup_ol

Start the softtware

$ ./scripts/solr.sh start
$ make run

Running OpenLibrary this way will monopolize the window.  So the following commands will need to be in a new window.  Remember to set your PATH in the new window.

$ make load_sample_data
$ ./scripts/solr.sh stop

Terminate the make run.

$ ./scripts/solr.sh start
$ make run

Same caveat above applies about monopolizing the window.

The instructions talk about how to run the website properly.  For me, this is fine for now.

Leave a Reply

%d bloggers like this: