loris-imageserver / loris

Loris IIIF Image Server
Other
208 stars 87 forks source link

Loris on Debian "Jessie" 8: errors during installation #420

Open netsensei opened 6 years ago

netsensei commented 6 years ago

I've successfully installed Loris on Debian "Jessie" 8 following the installation instructions. But it didn't went smoothly: I encountered several errors along the way. I posted my experience on Twitter and @azaroth42 asked me to drop this here.

This is a quick 'n dirty step by step list of actions I performed to get Loris running.

Setup

I'm doing this in a Vagrant/Virtualbox setup with some basic provisioning from Ansible (git, etc.) I use this vagrant box as the image I'm starting off: a vanilla Debian "Jessie" 8.

I ended up with Python 2.7.9 on the Bash prompt.

Step by step installation.

After installation. Logged in with the vagrant user:

First, install some basics:

adduser loris
sudo apt-get install build-essential
sudo apt-get install zlib1g-dev libssl-dev python-dev

sudo apt-get install python-pip
sudo pip install --upgrade pip
sudo pip install virtualenv

cd /opt
sudo curl -LO https://github.com/loris-imageserver/loris/archive/v2.3.2.tar.gz
sudo mv loris-2.3.2 loris
cd /opt/loris

sudo virtualenv env
. env/bin/activate

Let's install Workzeug:

sudo pip install Werkzeug

Moving on to Pillow:

sudo apt-get install libjpeg62-turbo-dev libfreetype6-dev zlib1g-dev \
liblcms2-dev liblcms2-utils libtiff5-dev python-dev libwebp-dev apache2 \
libapache2-mod-wsgi

The original command in the README points out to install libjpeg-turbo8-dev. But that package doesn't exist in Debian 8. Change this to libjpeg62-turbo-dev

Moving on:

sudo pip uninstall Pillow

I tried reïnstalling Pillow via pip, but I don't get the output mentioned in the README. Just a plain "Okay, I installed the binary for you" statement. I do get the mentioned output when I run setup.py later on.

Moving on to setup.py. I don't change anything to the configuration in etc/loris2.conf. Everything works just fine by default out of the box.

sudo python setup.py install

Now, here I do encounter 3 nasty errors.

Error 1

Package libffi was not found in the pkg-config search path.
fatal error: ffi.h: No such file or directory

This one is caused by a missing apt dependency:

sudo apt-get install libffi-dev

Error 1

Setup script exited with error in cryptography setup command: Invalid environment marker: python_version < '3'

I solved this one by doing this:

pip install cffi
sudo pip install --upgrade setuptools

Oddly enough, the upgrade seems to just reinstall the same version of setuptools. But that does solve the marker problem...

Error 3

ImportError: No module named configobj

Same issue: reinstall configobj solves this error:

sudo pip install configobj

For each error, you need to re-run setup.py. If you solved all three errors, setup.py should exit without errors and you can move in with the setup.

virtualenv in wsgi: sudo nano /var/www/loris2/loris2.wsgi

Now add these lines:

import site
site.addsitedir('/opt/loris/env/local/lib/python2.7/site-packages')

Apache configuration: sudo nano /etc/apache2/sites-available/000-default.conf

ExpiresActive On
ExpiresDefault "access plus 5184000 seconds"

AllowEncodedSlashes On

WSGIDaemonProcess loris2 user=loris group=loris processes=10 threads=15 maximum-requests=10000
WSGIScriptAlias /loris /var/www/loris2/loris2.wsgi
WSGIProcessGroup loris2

Okay, now we can reload Apache2. First we need to enable 2 modules. The Headers module, which is mentioned in the README... and the wsgi module, which is not mentioned in the README!

sudo a2enmod wsgi
sudo a2enmod headers expires
sudo service apache2 reload 

navigate to http://server/loris => You'll get an "Internal server error"

So, let's check out sudo tail /var/log/apache2/error.log which will tell you something like this:

ile "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 105, in <module>
SSL_ST_INIT = lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Solution: `sudo pip install --upgrade pyOpenSSL``

Again, it just reinstalls both cryptography 2.1.4 and pyOpenSSL 0.14... and that solves the errors.

Reload apache2 once more for good measure: sudo service apache2 reload

navigate to http://server/loris, you should now see the Loris welcome message:

This is Loris, an image server that implements the IIIF Image API Level 2. See
<http://iiif.io/api/image/2.0/> for details and <https://github.com/loris-imageserver/loris>
for the source code and implementation details.

TL;DR: I tried installing Loris on Debian Jessie with Python 2.7.9. I encountered a few annoying Python dependency messages. And a few minor differences in DEB package dependencies compared to Ubuntu/Debian 6/7.

bcail commented 6 years ago

@netsensei Thanks for posting this information! We should incorporate it into the Loris documentation. Feel free to submit a PR.