I don't have that much experience with Linux (I use Fedora 29) or Terminal, so I tried follow the Installation notes (https://downloads.ccdc.cam.ac.uk/documentation/API/installation_notes.html) step by step in order to correctly install the 2019 version of CSD Python API. During this, I stumbled upon an issue at step 5 of "Using pip on Linux and macOS", specifically the LD_LIBRARY_PATH part. If I run the command "export LD_LIBRARY_PATH="/lib/python2.7/site-packages/ccdc/_lib:$LD_LIBRARY_PATH" in Terminal directly, I can access CSD in Python without any problem. However, whenever I add that line to my .bashrc or .bash_profile file, my desktop environment (KDE Plasma) fails upon rebooting my computer, giving the error "Could not start kdeinit5". As it seems very cumbersome to manually run the line in question each time I want to use CSD in Python, I hope someone can tell me what it is that I'm doing wrong.

I'm guessing it has something to do with "$PYTHONHOME", but the command ran fine in Terminal when I entered it manually without including that part. I tried running it with "export PYTHONHOME="/usr/bin/python2.7:$PYTHONHOME" " preceding the "export LD_LIBRARY_PATH="$PYTHONHOME/lib/python2.7/site-packages/ccdc/_lib:$LD_LIBRARY_PATH" line, but that didn't solve anything. 


NB: please keep in mind that my knowledge and experience is very basic when replying

Hi,

If you are using $PYTHONHOME in your .bashrc or similar then it will need to be set beforehand - to keep things simple you may want to use the explicit value instead when setting LD_LIBRARY_PATH so you don't need to worry about PYTHONHOME. So a line such as

export LD_LIBRARY_PATH=/lib/python2.7/site-packages/ccdc/_lib:$LD_LIBRARY_PATH

should work.

However, your error makes me suspect that there is a library issue with your desktop software when it loads if you do this - it's possible that the desktop requires different versions of some libraries we include with our API, and this export command will cause our library location to be searched first for anything that you subsequently load (as it is first in the list). This can break other software, so it's really best to only set this environment when using python with our API.

What I'd suggest using instead is python's virtualenv. This allows you to set up a virtual python environment that you can source at the command line, and that virtual environment can include environment variables. You would then only source this environment when you're working with python and our API. Some documentation on virtualenv can be found here:

https://virtualenv.pypa.io/en/latest/userguide/


Once created, you would need to edit the activate or postactivate script for the created environment to also include your export LD_LIBRARY_PATH command. This is a good guide to doing that (with virtualenv and virtualenvwrapper):

http://barkas.com/2016/set-environment-variables-activating-virtualenv/

Hi,

I cannot seem to access the ccdc module in python within the virual environment I created, even when using --system-site-packages. When I run the activation script for the virtual environment and then run "export LD_LIBRARY_PATH=/lib/python2.7/site-packages/ccdc/_lib:$LD_LIBRARY_PATH" (just to test out whether the ccdc module was working, I intend to follow the second part of your instructions when I know the ccdc module works), I receive the following error message after starting up python and running "import ccdc":

This application failed to start because it could not find or load the Qt platform plugin "xcb" 
in "".

Reinstalling the application may fix this problem.
Aborted (core dumped)

I cannot seem to figure out how to resolve this issue. Do you know by any chance what causes this error?

Using a different desktop environment solved the issue.

You must be signed in to post in this forum.