Working with Multiple Versions of IBM SPSS Statistics (Python)

Multiple versions of the IBM® SPSS® Statistics - Integration Plug-in for Python can be used on the same machine, each associated with a major version of IBM SPSS Statistics, such as 22 or 23.

Running Python Scripts from Within IBM SPSS Statistics

By default, Python scripts run from within the last installed version of IBM SPSS Statistics will automatically use the appropriate version of the plug-in. To run Python scripts from within a different version of IBM SPSS Statistics, use the SpssClient.SetDefaultJCVersion method to set the default to a different version (the setting persists across sessions). You can then run Python scripts from within the other version. If you are attempting to change the default version from 16.0 to 17.0, additional configuration is required; please see the Notes below.

Running Python Scripts from an External Python Process

When running Python scripts from a separate Python process, such as the Python interpreter or a Python IDE, the plug-in will drive the version of IBM SPSS Statistics that matches the default plug-in version specified for that version of Python. Unless you change it, the default plug-in version for a given version of Python (such as Python 2.7) is the last one installed. You can view the default version using the SpssClient.GetDefaultJCVersion method and you can change the default version using the SpssClient.SetDefaultJCVersion method. The setting persists across sessions. If you are attempting to change the default version from 16.0 to 17.0, additional configuration is required; please see the Notes below.

Notes

To change the default version from 16.0 to 17.0, you will need to manually modify the file SpssClient.pth located in the Python 2.5 site-packages directory. Change the order of entries in the file so that the first line is SpssClient170. You should also ensure that the first line in spss.pth (also located in site-packages) is spss170.

  • Windows. The site-packages directory is located in the Lib directory under the Python 2.5 installation directory—for example, C:\Python25\Lib\site-packages.
  • Mac OS X 10.4 (Tiger). The site-packages directory is located at /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages.
  • Mac OS X 10.5 (Leopard). The site-packages directory is located at /Library/Python/2.5/site-packages.
  • Linux and UNIX Server. The site-packages directory is located in the /lib/python2.5/ directory under the Python 2.5 installation directory—for example, /usr/local/python25/lib/python2.5/site-packages.