Known issues

If your problem isn’t addressed below, we invite you to visit the Technical Help section of the CSD Python Community Forum at http://www.ccdc.cam.ac.uk/forum/csd_python_api/

New Issue: “relocation error” on Linux with miniconda3

When importing the ccdc package on, e.g., CentOS 6, the following error may be reported.

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-vagrant'
python: relocation error: /home/vagrant/CCDC/miniconda3/lib/python3.7/site-packages/ccdc/_lib/plugins/xcbglintegrations/libqxcb-glx-integration.so: symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference

A workaround is to manually copy the CCDC provided Qt5 libraries over the Miniconda provided Qt5 libraries.

New issue: Matplotlib “ImportError: DLL load failed: The specified procedure could not be found.”

On Windows, when ccdc is imported before matplotlib, matplotlib will fail with the above error message.

Importing matplotlib and selecting a non-Qt rendering backend before importing ccdc works:

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plot
import ccdc

Diagram highlighting gives misleading results if used with shrunken symbols

When generating 2D diagrams of molecules and crystals it is recommended to set the ccdc.diagram.DiagramGenerator.Settings.shrink_symbols setting to False as it may otherwise give misleading images.

This issue does not manifest itself when using ccdc.entry.Entry where the 2D coordinates are taken from the CSD.

Diagrams have coloured rectangles in place of atom labels and group symbols

On some versions of Linux it is possible that no suitable fonts are installed for the diagram rendering code. The consequence is that the unknown character glyph is displayed for every label. Please ensure that any font matching “Helvetica” is available.

On RHEL/CentOS Linux, this can be resolved by installing the dejavu-sans-fonts package.

On macOS, creating multiple diagrams in a single session can lead to crashes

In some scripts, conflicts between matplotlib and other CSD Python API dependencies may lead to crashes during diagram generation.

Matplotlib supports multiple rendering backends. We recommend the “TkAgg” option on macOS, and this avoids the diagram generation crashes. This backend should be selected when importing the matplotlib module.

import matplotlib
matplotlib.use('TkAgg')

Example scripts fail on Ubuntu 14 with “GLib-GIO-Message: Using the ‘memory’ GSettings backend. …”

The installed Python matplotlib package is known to not work on Ubuntu 14 due to a bug, see https://github.com/conda-forge/glib-feedstock/issues/19 for further details.

While the CSD Python API will work correctly, some example scripts are expected fail. A fix is to set the GIO_EXTRA_MODULES environment variable:

export GIO_EXTRA_MODULES=/usr/lib/x86_64-linux-gnu/gio/modules/

Problem with macOS XQuartz versions prior to 2.7.8

For macOS users, if a script fails to run with an error containing a message similar to “Library not loaded: /usr/X11/lib/libfreetype.6.dylib”.

Please ensure that your XQuartz installation is updated to at least v.2.7.8. There are known problems with earlier versions.

Numpy install fails with “error: Unable to find vcvarsall.bat”

Numpy is not required for the core CSD Python API package, but it can be optionally installed for use within some of the example scripts.

On Windows, the install may stop due to a failure during the numpy installation step. This results from the Visual C++ 2008 runtime libraries are not installed on the computer. These can be added through installation of the free Visual C++ 2008 Express Edition.

lxml install fails with “Could not find function xmlCheckVersion in library libxml2…”

On Windows, the install may stop due to failure in the lxml installation step. Near the end of the failure message is:

*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************

A solution to this is to manually install lxml by running lxml-3.5.0.win32-py2.7.exe downloaded from https://pypi.python.org/pypi/lxml/3.5.0 and then repeating the CSD Python API install.

‘’ImportError: No module named DLFCN’’ error during import

Virtual environments on RedHat and CentOS systems may not set the Python system path properly. This will cause the CSD Python API to fail to load with an error like ImportError: No module named DLFCN. See virtualenv Bug 874 for further details. To prevent this, you should extend the PYTHONPATH environment variable to include the directory that contains the DLFCN module.

For example, this can be achieved with the following:

export PYTHONPATH="`python -c "import DLFCN; import os.path; \
print(os.path.dirname(DLFCN.__file__))"`:$PYTHONPATH"

‘’ImportError: DLL load failed: %1 is not a valid Win32 application’’ error during import

On Windows, if the 64-bit version of the CSD Python API package is installed into a 32-bit python system, or the converse, a python traceback would be seen during import. If the final lines of the traceback resemble the following, please install the alternative version of the CSD Python API.

File "C:\Program Files\CCDC\Python_API_2020\miniconda\lib\site-packages\ccdc\_lib\UtilitiesLib.py",
line 24, in swig_import_helper
    _mod = imp.load_module('_UtilitiesLib', fp, pathname, description)
ImportError: DLL load failed: %1 is not a valid Win32 application.

‘’failed to get the current screen resources’’ message on Ubuntu 16

The above message is output following import ccdc. This is harmless and can be ignored.

Error messages including ‘’{contents = “KeyboardLayout Name”}’’ on macOS

On macOS only, messages such as the following can be output following import ccdc. These messages are harmless, but may be avoided by adding another keyboard layout in System Preferences | Keyboard | Input Sources on the macOS desktop.

python[23366:1195030] isPrefsCreateCacheFromEnabledAndDefaultInputSources - can't find anything from GetInputSourceEnabledPrefs, use defaultASCIIKeyLayoutDict = <CFBasicHash 0x7f916d44fb40 [0x7fff9314e8f0]>{type = mutable dict, count = 3, entries =>
0 : <CFString 0x7fff931b97f8 [0x7fff9314e8f0]>{contents = "InputSourceKind"} = <CFString 0x7fff931fed38 [0x7fff9314e8f0]>{contents = "Keyboard Layout"}
1 : <CFString 0x7fff931eae78 [0x7fff9314e8f0]>{contents = "KeyboardLayout ID"} = <CFNumber 0x237 [0x7fff9314e8f0]>{value = +2, type = kCFNumberSInt64Type}
9 : <CFString 0x7fff931b44f8 [0x7fff9314e8f0]>{contents = "KeyboardLayout Name"} = <CFString 0x7f916f9641d0 [0x7fff9314e8f0]>{contents = "British"}