SPSS Statistics

Expand all | Collapse all

Py2.7, SPSS V27, external, "No StartXD.exe file exists"

  • 1.  Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 06, 2021 09:20 AM
    Hi there!

    Our company is going to migrate to SPSS V27, however we still have some external code and programs, running from external GUI and written in Python 2.7.
    As I understood, it should be possible to use Py2.7 with SPSS V27. I already have created sitecustomize.py to add the paths of the SPSS modules to the sys.path. The modules (e.g. os, sys, wx, spss, spssaux, spssdata) will be loaded, but when spss.py tries to start an instance of SPSS V27 an error message is displayed:

    No StartXD.exe file exists
    Error.
    IBM SPSS Statistics backend is not ready.

    This message will be shown when using the following code:

    import spss
    try:
       spss.StartSPSS()
    except spss.SpssError:
       print "Error."
    print spss.GetLastErrorMessage()


    Any suggestions how to solve the problem?


    Thanks and best regards,
    Alexander

    ------------------------------
    Alexander Mentrup, (r)evolution GmbH
    ------------------------------


  • 2.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 06, 2021 09:54 AM
    I presume that you have installed Python 2.7 and that installation is on your external Python path.  If it isn't, you may need to set the PYTHONPATH environment variable.  On my new machine I have V27/27.0.1 with Python3 but have avoided installing Python2 as I want to leave that behind.  All of the Python- based extension commands were converted to Python3, so if you are using any of those, that should not be a problem.  (I did find and report a few cases where that conversion was not 100% correct.)

    Check that the Python 2.7 installation works from within SPSS Statistics, possibly after adjusting the setting in Edit > Options > Files.

    StartXD.exe should be in the Statistics installation directory.
    Look also at the spssdxcfg.ini in that directory to make sure that Python2 is listed.

    Also try Python3 externally to see whether that works.

    I have an extension command that converts Python2 code to Python3.  The conversion doesn't catch everything, but it is a good starting point.  It isn't published yet due to problems with the Custom Dialog Builder, but the syntax usage works.  I can post it for you if you want to try it out.  It will convert Python2 code that is either in standalone .py files (typically a whole directory at once) or embedded in .sps files wrapped in BEGIN/END Python or Python2 blocks.

    --





  • 3.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 06, 2021 11:14 AM
    Hi Jon,
    Thanks for the quick answer.

    The Python 2.7 installation is already linked to SPSS V27 via Edit > Options > Files.
    Python2.7 code is running well from the syntax editor.
    The file "StartXD.exe" exists at <C:\Program Files\IBM\SPSS\Statistics\27\StartXD.exe>.
    The config file <C:\Program Files\IBM\SPSS\Statistics\27\Python\Lib\site-packages\spss\spssxdcfg.ini> is also adjusted at line 2:
    "spssxd_path=C:\Program Files\IBM\SPSS\Statistics\27"
    Should I have to add a Python2.7 path or anything else? 
    Or do you have any other idea? 

    I have not tried to use Py3 externally as the other way is currently our priority - although we will migrate totally to Python3 sometime. But, for daily business we need to get the Python 2.7 environment running.

    Apart from this, of course I am interested in the extension command for conversion of Python2 code. That would definitely be helpful.

    Best regards,
    Alexander


    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 4.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 06, 2021 12:33 PM
    I think the spssxdcfg.ini file needs to be in the Python\Lib\site-packages\spss directory under your Statistics installation as well as in the corresponding python3 directory.
    It shouldn't be necessary, but you might also try adding the Statistics installation directory to your system path.

    If these changes don't work, I'll have to ask the Development team what the algorithm for finding the startXD module is.

    I have to get the extension command from my old machine, so I'll post that to my OneDrive site later today.

    ------------------------------
    Jon Peck
    ------------------------------



  • 5.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Thu January 07, 2021 03:22 AM
    Hi Jon,

    I have now stored the config file with same settings at the following locations: 
    <C:\Program Files\IBM\SPSS\Statistics\27\Python\Lib\site-packages\spss\spssxdcfg.ini>
    <C:\Program Files\IBM\SPSS\Statistics\27\Python3\Lib\site-packages\spss\spssxdcfg.ini>
    <C:\WinPython-64bit-2.7.10.2_TEST\python-2.7.10.amd64\Lib\site-packages\spss\spssxdcfg.ini>
    The last one is my Py2.7 installation.
    But, this also doesnt help.

    I am not sure, what you mean with "try adding the Statistics installation directory to your system path".
    The python sys.path is already extended by sitecustomize.py: 
    sys.path.append("C:\\Program Files\\IBM\\SPSS\\Statistics\\27\\Python\\Lib\\site-packages\\")
    sys.path.append("C:\\Program Files\\IBM\\SPSS\\Statistics\\27\\Python\\Lib\\")
    sys.path.append("C:\\Program Files\\IBM\\SPSS\\Statistics\\27\\Python\\")
    sys.path.append("C:\\Program Files\\IBM\\SPSS\\Statistics\\27\\")
    Without that, Py2.7 will not import any spss module. But that works fine.

    Would be glad, if you have any other suggestion or if you could ask the Development team.

    Best regards,
    Alexander

    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 6.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Thu January 07, 2021 09:49 AM
    I have a query in to the development team, but what I was suggesting was adding the Statistics installation directory to the system PATH variable via the Windows Control Panel not the Python sys.path.

    I'll let you know what I hear from the dev team.

    --





  • 7.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 13, 2021 02:59 AM
    Hi Jon,

    meanwhile I have tested to add the SPSS Statistics installation directory (C:\Program Files\IBM\SPSS\Statistics\27) to the system variable "Path". Unfortunately, this also did not help.

    The current status is:
    Using Py2.7 within SPSS27: works.
    Using Py2.7 externally with SPSS27: works not.
    Using Py3.8 within SPSS27: works.
    Using Py3.8 externally with SPSS27: works.

    A colleague also tried to start SPSS27 with Py2.7 externally while having the demo/subscription version of SPSS27 installed. Surprisingly, this was successful.
    We think the problem could be the StartXD.exe.

    Do you already have feedback from the developement team?

    Best regards
    Alexander

    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 8.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 06, 2021 05:58 PM
    I have posted the STATS PYTHON CONVERT extension command here:
    https://1drv.ms/u/s!AoWcE61g_FAdisIcF4kHvYQTy88cgw?e=7UioZ9
    I think with 27.0.1 that the dialog box will work, but the syntax is pretty simple.  Let me know when you try it how it works.

    One thing I have run into that converters can't deal with is integer division.  In Python 3, / always does float division.  In Python 2, integers got integer division.  The converter doesn't know which is meant, so if you need integer division, you will need to change the / to //

    ------------------------------
    Jon Peck
    ------------------------------



  • 9.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 13, 2021 03:08 AM
    Hi Jon,

    Thank you for the conversion tool. I have installed it to SPSS27, however I was not able to start it. If I choose a file to convert and define a directory to store the converted file and then click "Ok" I`ll get the following error:
    Error number 1. Command name: STATS
    The first word in the line is not recognized as a SPSS command.

    Do have an idea how to get the extension running?

    Best regards
    Alexander

    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 10.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Wed January 13, 2021 09:00 AM
    That message means that the extension command is not actually installed.  If you ran the installation, you can look in the directories listed in the output from SHOW EXT in the extension commands section.  You should see a file named STATS_CONVERT_PYTHON.xml.  If it isn't in one of those directories, you might have a file permission problem with the install.

    --





  • 11.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Fri January 15, 2021 03:37 PM
    I have posted a new version of STATS CONVERT PYTHON on my OneDrive site here
    https://1drv.ms/u/s!AoWcE61g_FAdisIcF4kHvYQTy88cgw?e=lMi7ba

    This is the candidate final version.  It has improvements in error handling and result reporting, and it eliminates some dump output that resulted from a conflict between the SPSS apis and the Python library conversion routines.

    ------------------------------
    Jon Peck
    ------------------------------



  • 12.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Mon January 18, 2021 02:51 AM
    Hi Jon,
    thank you for the new version, which I have installed for SPSS27 after having deinstalled the prior version.
    However, I still can not execute the command. The installation was successful and there are three files stored in <C:\ProgramData\IBM\SPSS\Statistics\27\CustomDialogs\fileconversion\>: defaultExtensionDialog.png, fileconversion.properties and fileconversion.xml. When I try to run the custom extension I`ll get the same error as before.
    Best regards
    Alexander

    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 13.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Mon January 18, 2021 09:51 AM
    I have lost track of what that error is.  However, I will be posting a new version of STATS CONVERT PYTHON probably later today.  It has a number of new features, and it handles result reporting and errors better.

    --





  • 14.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Mon January 18, 2021 11:10 AM

    Now I remember.  How are you running Statistics externally?  IDE, console, Idle?





  • 15.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Mon January 18, 2021 12:00 PM
    Hi Jon,
    still, the main problem is getting SPSS27 run with external Py2.7 code (see posts #16 and previous).
    We use WingIDE or VisualStudioCode to run SPSS externally.
    The other thing is, that I can not get your STATS CONVERT PYTHON extension run. However, this is less important.
    Best regards
    Alexander


    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 16.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Mon January 18, 2021 12:31 PM
    I use WingIDE, too.  It's a great tool.  I don't have Python 2 installed with SPSS 27, but do  you have the Project Properties set correctly for Python 2?  Besides the Python executable, you would need the Python2\lib\site-packages directory under the Statistics installation on the Python path.  

    Then I would debug through an import spss statement to try to find the point where things go wrong.

    --





  • 17.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Fri January 22, 2021 02:45 AM
    Hi Jon,
    we made some more tests and still, have no idea, why SPSS27 could not be started externally with Py2.7. Here is what we did:

    - import spss works without any error
    - but, when trying to use spss.Submit(xxxx) the following error occurs at the line "if not IsBackendReady(): StartSPSS()"
      "spss\spss.py", line 253, in StartSPSS raise SpssError,error
       SpssError: [errLevel 17] IBM SPSS Statistics backend is not ready.
    - we retrieve a False statement with spss.IsBackendReady()
    - the actual error occurs in PyInvokeSpss.StartSpss(commandLine)

    • The parameter in commandLine in our test is a real path behind the "-out"
    • Apparently the StartXD.exe (Date of file 09.10.2020) does not start
    • The date of StartXD.exe of our Demo/Subsription SPSS27 version is 07.11.2019 - this one works propperly with Py2.7.

    Does PyInvokeSpss need or look at some environment variables?

    We also took a look at the .bat files you mentioned (see post 17). But, we do not understand how this could help and this was also never needed before.

    Would be really helpful if you or the development team have any further idea, or even better a solution for us. Otherwise we can not use SPSS27 as we intended to.

    Best regards
    Alexander

    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 18.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Thu January 14, 2021 11:24 AM
    Some information from Development for Python 2.
    There are two bat files in the Statistics installation directory.  For external mode you need to do the equivalent of what is in them to get Python 2 to work in external mode.
    They are statisticspython.bat and statisticspythonw.bat.(the latter mostly just calls the former).

    There are equivalent bat files for Python3.

    On Wed, Jan 6, 2021 at 7:53 AM Jon Peck <jkpeck@gmail.com> wrote:
    I presume that you have installed Python 2.7 and that installation is on your external Python path.  If it isn't, you may need to set the PYTHONPATH environment variable.  On my new machine I have V27/27.0.1 with Python3 but have avoided installing Python2 as I want to leave that behind.  All of the Python- based extension commands were converted to Python3, so if you are using any of those, that should not be a problem.  (I did find and report a few cases where that conversion was not 100% correct.)

    Check that the Python 2.7 installation works from within SPSS Statistics, possibly after adjusting the setting in Edit > Options > Files.

    StartXD.exe should be in the Statistics installation directory.
    Look also at the spssdxcfg.ini in that directory to make sure that Python2 is listed.

    Also try Python3 externally to see whether that works.

    I have an extension command that converts Python2 code to Python3.  The conversion doesn't catch everything, but it is a good starting point.  It isn't published yet due to problems with the Custom Dialog Builder, but the syntax usage works.  I can post it for you if you want to try it out.  It will convert Python2 code that is either in standalone .py files (typically a whole directory at once) or embedded in .sps files wrapped in BEGIN/END Python or Python2 blocks.

    --


    --





  • 19.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Fri January 15, 2021 07:19 AM
    Hi Jon,
    I have found the files and also tried to understand the code. But, I am afraid, I do not understand what the files are for and what they do. Furthermore, should I try to execute them or should I have to adjust them?
    Could you please give me some further info what to do with the .bat files?
    Best regards
    Alexander

    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------



  • 20.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted Mon January 18, 2021 06:13 PM
    New version of STATS CONVERT PYTHON posted here.

    https://1drv.ms/u/s!AoWcE61g_FAdisIcF4kHvYQTy88cgw?e=Y5Pndg

    Let me know what you discover debugging into import spss externally

    ------------------------------
    Jon Peck
    ------------------------------



  • 21.  RE: Py2.7, SPSS V27, external, "No StartXD.exe file exists"

    Posted 13 days ago
    Hello Jon.
    Since I have not heard from you or the development team for a while: Are there any news on our issue not to get SPSS V27 started from py2.7? We still can not use the software as intended to. If this problem could not be solved, we have to think about if we can return the software.
    Best regards
    Alexander

    ------------------------------
    Alexander Mentrup
    (r)evolution GmbH
    Bonn
    ------------------------------