Additional requirements for installing on Windows

When installing the CSD Python API on Windows, the installation process may require downloading and installing numpy. The numpy module has a requirement for the Microsoft C++ Compiler for Python 2.7 - if this is not present installation will fail with a message like:


  error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
t it from

  Failed building wheel for numpy


You will need to follow the link to and install it and then re-run the CSD Python API install.

Use of the API on some international versions of Windows


We are aware of an issue with the CSD Python API when used on Japanese versions of Windows. If using the API on such a system you see an error alike:


"SyntaxError: Non-ASCII character '\xe2' in file C:\Python27\Lib\site-packages\ccdc\

Then edit the file C:\Python27\Lib\site-packages\ccdc\ and remove line 502 that contains:


"The crystal packing similarity class is under development – currently available only to associated collaborators."


This line appears to contain a non-ascii chararacter that is causing issues on some systems.

We have seen some cases in Windows where the pip installation of the CSD Python API fails due to an error building the lxml Python package. The end of the installation output will look something like:

    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    error: command 'C:\\Users\\someuser\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\someuser\\appdata\\local\\temp\\pip-build-bznxq6\\lxml\\';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record c:\users\db-ser~1\appdata\local\temp\pip-9laak8-record\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in

(The last line may be wrapped differently as it is very long.)

The simplest solution is to download the binary wheel package from here:
(If that link doesn't work, you can go to here:
and download the file named lxml‑3.5.0‑cp27‑none‑win32.whl . )

You would then install it using pip install lxml‑3.5.0‑cp27‑none‑win32.whl. Once this is done, rerun the CSD API pip install.

We have noticed there can sometimes be problems with creating a digram via the crystal structure report option in the Mercury scripts menu. If you experience this problem, the issue can be resolved by adding the following before line 59 in in Mercury's scripts folder:




so that this section reads:


    # Read crystal relating to entry_id from any supported file format
    entry = helper.current_entry
    crystal = entry.crystal
    molecule = crystal.molecule
    tableno = 1


The script will be updated with the fix in a future release.

You must be signed in to post in this forum.