• RE: RuntimeError: Welcome to the CSD Python API. No valid licence located.

    Hi Richard,


    On Windows the CSD Python API should use the registry key entries set up by the CSDS installer to work out where your data directory is, and if that contains a csd_licence.dat licence file then it should pick it up from there. You can use CSDHOME to override this, but usually it should not be necessary.


    Mercury is one of the programs in the CSD package that can be started without a licence present (it will have reduced functionality until the package is licensed) so it is worth checking it by going to Help->About Mercury. Does it state it is registered, and if so where is the licence file it is stating it is using? Note that for the API to pick up the licence file automatically it will need to either be in the CSD data directory (in your case C:\Program Files (x86)\CCDC\CSD_2016\CSD V5.37) or in the home area of the user that is running it. With use of admin/user accounts in your post, I'd recommend the licence file being located in the database directory so all users can access it.

    Note that rather than trying to run the tests, the correct reading of a licence can be tested with the following at your python command line prompt:


    import ccdc.io



    This should output the CSD databases in use if the licence check passes and give the error you have described if not.


    Lastly, if your organisation has access to the 2017 release, I would recommend taking a look at that - it comes with its own python pre-installed for ease of use.






  • RE: Headless installation

    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:


    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.

  • RE: Can't access "Write PDF file to view/ print"

    Hi Rajdip,


    For future reference this forum is for discussion of the CSD Python API - for support of our other products please contact at us at support@ccdc.cam.ac.uk.


    Exporting to PDF should be resolved in the first update we released for the 2016 CSD System in February - please ensure that this has been installed (if it has, ConQuest's Help->About ConQuest menu should report itself as 'Build RC2').


    The software update can be obtained via the details given here: http://www.ccdc.cam.ac.uk/support-and-resources/ccdcresources/downloadcsd2016-updatecsd2016/

  • RE: Installation failing on OSX el capitan

    Hi Jack,


    Firstly we'd highly recommend using Anaconda python rather than standard python on Mac OS X. Anaconda comes with many packages pre-installed, like lxml which appears to be the package you're having trouble with here.


    That said, as the error message suggests, installing xcode from the apple store then running "xcode-select --install" from a terminal window should help ensure the required libraries are installed.



  • RE: Technical Help FAQs

    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:




    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.

  • RE: Installion woes: CSD Python API 0.7.0 on a Mac

    With the 1.0 release of the CSD Python API we have made an installer specifically for Anaconda Python, and this is now the recommend way to use the CSD Python API on Mac OS X. If using standard Python, we would recommend using the pre-compiled installer as provided on the Python download website.

  • RE: Script failing due to time-out

    Hi Luca,

    When running a script via the Mercury interface, Mercury will wait for a maximum of 3 minutes for that script to complete before releasing the interface to allow it to be used again.

    If the script is still running after 3 minutes then you will receive the "The python process did not finish before the time-out" error, but the script will also continue running in the background. The error message also details where the output for the script is being produced, so you can review the files there at a later time. You should be able to open the geometry report in that output folder directly once it is complete.



  • RE: Problem with test

    Hi Luca,


    Some aspects of the Python API will require the Microsoft Visual C++ 2013 runtime libraries to be installed. You can obtain a copy from:







  • RE: Technical Help FAQs

    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.

  • RE: RunTime error

    Hi Geoff,


    The issue here is that you need to pass csd_reader.molecule on line 102 of your script a single refcode - you're actually passing it many recodes with '|' as a separator, hence the error message.


    You could, for example, use split to get a list of all the recodes in that string: https://docs.python.org/2/library/stdtypes.html#str.split

    Or you could look at constructing your list appropriately in the screen_substructure function so that you have single identifiers ready to pass in to csd_reader.molecule.