I've just upgraded to Granta SDK 2.0 but where's the new API?

James Derrick
James Derrick Administrator, Employee Posts: 275
Ancient Membership 100 Comments 100 Likes 25 Answers
admin
edited June 2023 in Materials

This is a common question I've received.

I've just upgraded but when I try to do the import in the examples from GRANTA_MIScriptingToolkit import granta as mpy, it says that "granta" can't be found. What gives?

Answers

  • James Derrick
    James Derrick Administrator, Employee Posts: 275
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin
    Answer ✓

    When we moved from 1.5 to 2.0 we changed the way the STK is installed, and where it is installed. The two installation methods are incompatible so you need to "manually" remove your previous version/remove it from the pythonpath (uninstall it through the "uninstall programs" window on windows).

    This change was made because in versions <1.5 the STK was not installed with all the other python packages, as is common with pip, and users had to do a lot of work editing the path if they wanted to use the SDK in a virtual environment.

    From 2.0 onwards the installation method uses pip, and this step does not need to be repeated; the package gets handled by pip like any other and future installations will automatically uninstall the previous version.