Has anyone managed to install the Python API on a headless system? If so, it would be great to hear how.

I want to add the CSD Python API to a virtual machine that already contains the other dependencies of our project.  We like to be able to check in our provisioning scripts so all team members can easily get the same development environment.

So far, I have downloaded and run csds-linux-x64.run and CSDSQLite-2016-linux-x64-installer.run. This was more painful than it need be, since neither is well suited to unattended installation.

Installing the python API does not seem to work - python -c 'import ccdc' fails.

I think that this is because I must start one of the programs in order to accept the license. However, none of the programs start, because they can't find libX11 or libGL. 

Do I really have to install XWindows in order to install get a license? This may be friendly to click-and-point users, but it is not friendly to the sort of people who want an API.

Corrected, this seems to work.However, you need parts of X11 to make the python API load, namely:

    fontconfig libX libXrender libGL

 

Here is a provisioning script for a Centos/Redhat system. Not fully tested, because I built it up bit by bit, but I hoipe it helps someone:

# Run from Vagrantfile the first time a VM is provisioned.
# To run again, you must do vagrant destroy

# operating system dependencies, needed for CSD Python API
yum install -y fontconfig libX libXrender libGL

# import the Python dependencies
/root/anaconda3/bin/conda env create -f /vagrant/environment.yml -n addopt

# allow vagrant user to traverse to ananconda folder
chmod a+x /root
echo 'export PATH=$PATH:/root/anaconda3/bin/' >> /home/vagrant/.bashrc
echo 'source activate addopt' >> /home/vagrant/.bashrc

# Could check python installation
#python -c "import sys; print sys.maxunicode > 65536 and 'UCS-4' or 'UCS-2'" | (\
# read; if [ "$REPLY" != "UCS-4" ]
# then echo ERROR: Python must support UTF-4 for CCDC API, is $REPLY
#fi)

cd /vagrant/downloads

# Install CSDS - slow
if [ -e csds-2016-1-linux-x64.tar ]; then
tar -xf csds-2016-1-linux-x64.tar
./csds-linux-x64.run <<HERE
11
y

y
/home/vagrant/CCDC
y
y
y
1
y
n
n
HERE
fi

# install CDS database
if [ -e CSDSQLite-2016-linux-x64-installer.run ]
then ./CSDSQLite-2016-linux-x64-installer.run <<HERE2


y
/home/vagrant/CCDC/CSD_2016/csd
y
HERE2
fi
# set environment variables
export CSDHOME=/home/vagrant/CCDC/CSD_2016/csd
echo export CSDHOME=/home/vagrant/CCDC/CSD_2016/csd >> /home/vagrant/.bashrc
export CCDC_TOOLKIT_SQLITE_DATABASE=/home/vagrant/CCDC/CSD_2016/csd/as537be_ASER.sqlite
echo export CCDC_TOOLKIT_SQLITE_DATABASE=/home/vagrant/CCDC/CSD_2016/csd/as537be_ASER.sqlite >> /home/vagrant/.bashrc

# See https://downloads.ccdc.cam.ac.uk/documentation/API/installation_notes.html#installation
# install CCDC api.
# or pip install /vagrant/csd-python-api-1.0.0-linux-64-py2.7.tar.gz
if [-e csd-python-api-1.0.0-linux-64-py2.7-conda.tar.bz2]
then conda install --name addopt csd-python-api-1.0.0-linux-64-py2.7-conda.tar.bz2
fi

 

# test CCDC installation. TODO there are better tests.
# source activate addopt; python -c 'from ccdc import io'

Hi Chris,

The main CSDS and SQLite installers can be run in an unattended mode at the command line - see this FAQ for more details:

http://www.ccdc.cam.ac.uk/support-and-resources/support/case/?caseid=dc97d1f1-c3ee-4b71-b815-78101a8a26a9

All of our installers should detail the various command line options if you run them with the --help argument. This should allow you to install these packages in a simpler way than in the script you provided.

You are also correct that with the current release, licensing expects the ability to use a GUI for standard licensing - we do have some tools to help here, though, and a command line registration utility will be included with the forthcoming CSDS release to make this process a little easier.

Other than these two difficulties, as you've noted there are some package dependencies (such as libGL) that once installed should allow you to use the Python API on your headless system without too much difficulty.

You must be signed in to post in this forum.