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).
Ge
t it from http://aka.ms/vcpython27

  ----------------------------------------
  Failed building wheel for numpy

 

You will need to follow the link to http://aka.ms/vcpython27 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\crystal.py

Then edit the file C:\Python27\Lib\site-packages\ccdc\crystal.py 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\\setup.py';
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
c:\users\db-ser~1\appdata\local\temp\pip-build-bznxq6\lxml

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

The simplest solution is to download the binary wheel package from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/chfyvn4n/lxml-3.5.0-cp27-none-win32.whl
(If that link doesn't work, you can go to here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
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 crystal_structure_report.py in Mercury's scripts folder:

 

molecule.add_hydrogens()

 

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
    molecule.add_hydrogens()
    molecule.assign_bond_types(which='unknown')
    tableno = 1

 

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

You must be signed in to post in this forum.