SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  ImportError: No module named xlrd

    Posted Mon February 15, 2021 03:34 PM

    We have installed Python and the xlrd module conform the installationguide:

    https://www.spss-tutorials.com/xlrd-python/

    But after installation, we can't read the files and the last rule of the logg in SPSS is: ImportError: No module named xlrd

    How can we solve this issue?






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: ImportError: No module named xlrd

    Posted Mon February 15, 2021 04:37 PM

    You probably install xlrd to a different Python installation from what Statistics is using. After you installed Python, you have a new registered version. You then need to go to Edit > Options > Files and point to that version so that Statistics will use it. You would need to restart Statistics after that for that to take effect.

    If that doesn't fix things, please more details about your configuration. And are you using Python 2 or Python 3? I don't know whether xlrd has been updated to Python 3.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: ImportError: No module named xlrd

    Posted Tue February 16, 2021 03:52 PM

    We installed xlrd confirm the guide on website: http://www.spss-tutorials.com/xlrd-python/

    Here we added the value “C:\Program

    Files\IBM\SPSS\Statistics\26\Python3” to the Windows Environment

    Variables “PATH”.

    I had to use the Python3 folder because the other “C:\Program

    Files\IBM\SPSS\Statistics\26\Python” folder didn’t work.

    So we used the default Python3 installation within SPSS 26, we didn’t

    install a different Python version.

    During the Xlrd installation it gives a little warning, but it seems to be installing

    fine.

    Underneath you see the complete logging of the Xlrd installation.

    Hopefully you can tell us what we are doing wrong of what we are

    missing.

    C:\temp\xlrd-2.0.1>python setup.py install

    C:\Program

    Files\IBM\SPSS\Statistics\26\Python3\lib\distutils\dist.py:260: UserWarning: Unknown

    distribution option: 'python_requires'

    warnings.warn(msg)

    running install

    running bdist_egg

    running egg_info

    writing requirements to

    xlrd.egg-info\requires.txt

    writing xlrd.egg-info\PKG-INFO

    writing top-level names to

    xlrd.egg-info\top_level.txt

    writing dependency_links to

    xlrd.egg-info\dependency_links.txt

    reading manifest file

    'xlrd.egg-info\SOURCES.txt'

    reading manifest template 'MANIFEST.in'

    warning: no files found matching

    'README.md'

    writing manifest file

    'xlrd.egg-info\SOURCES.txt'

    installing library code to

    build\bdist.win-amd64\egg

    running install_lib

    running build_py

    creating build\bdist.win-amd64\egg

    creating build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\biffh.py ->

    build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\book.py ->

    build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\compdoc.py ->

    build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\formatting.py

    -> build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\formula.py ->

    build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\info.py ->

    build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\sheet.py ->

    build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\timemachine.py

    -> build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\xldate.py ->

    build\bdist.win-amd64\egg\xlrd

    copying build\lib\xlrd\__init__.py ->

    build\bdist.win-amd64\egg\xlrd

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\biffh.py to biffh.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\book.py to book.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\compdoc.py to compdoc.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\formatting.py to formatting.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\formula.py to formula.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\info.py to info.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\sheet.py to sheet.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\timemachine.py to timemachine.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\xldate.py to xldate.cpython-34.pyc

    byte-compiling

    build\bdist.win-amd64\egg\xlrd\__init__.py to __init__.cpython-34.pyc

    creating

    build\bdist.win-amd64\egg\EGG-INFO

    installing scripts to

    build\bdist.win-amd64\egg\EGG-INFO\scripts

    running install_scripts

    running build_scripts

    creating

    build\bdist.win-amd64\egg\EGG-INFO\scripts

    copying build\scripts-3.4\runxlrd.py

    -> build\bdist.win-amd64\egg\EGG-INFO\scripts

    copying xlrd.egg-info\PKG-INFO ->

    build\bdist.win-amd64\egg\EGG-INFO

    copying xlrd.egg-info\SOURCES.txt ->

    build\bdist.win-amd64\egg\EGG-INFO

    copying

    xlrd.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO

    copying xlrd.egg-info\requires.txt ->

    build\bdist.win-amd64\egg\EGG-INFO

    copying xlrd.egg-info\top_level.txt

    -> build\bdist.win-amd64\egg\EGG-INFO

    zip_safe flag not set; analyzing archive

    contents...

    creating 'dist\xlrd-2.0.1-py3.4.egg' and

    adding 'build\bdist.win-amd64\egg' to it

    removing 'build\bdist.win-amd64\egg'

    (and everything under it)

    Processing xlrd-2.0.1-py3.4.egg

    Removing c:\program

    files\ibm\spss\statistics\26\python3\lib\site-packages\xlrd-2.0.1-py3.4.egg

    Copying xlrd-2.0.1-py3.4.egg to

    c:\program files\ibm\spss\statistics\26\python3\lib\site-packages

    xlrd 2.0.1 is already the active version

    in easy-install.pth

    Installing runxlrd.py script to

    C:\Program Files\IBM\SPSS\Statistics\26\Python3\Scripts

    Installed c:\program

    files\ibm\spss\statistics\26\python3\lib\site-packages\xlrd-2.0.1-py3.4.egg

    Processing dependencies for xlrd==2.0.1

    Finished processing dependencies for

    xlrd==2.0.1

    C:\temp\xlrd-2.0.1>






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: ImportError: No module named xlrd

    Posted Tue February 16, 2021 04:21 PM

    I'm a little concerned about those warnings, but they may be harmless. Try this to diagnose the problem.

    Start Python 3 from a command prompt window - cd to the python 3 directory and type Python.

    type

    import xlrd

    You may get a more informative error message.

    It might also be that you have a file permissions problem, so you might need to do the install while running as administrator.

    Another issue: you say you installed Python. That would mean a different Python installation from the one installed with Statistics. If so, the Python 3 directory under the Statistics installation would be irrelevant. Within Statistics you would have needed to point to that alternative distribution.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 5.  RE: ImportError: No module named xlrd

    Posted Fri February 19, 2021 10:10 AM

    Hello John,

    Thank you for

    the quick reply.

    We have tried

    your trick to diagnose the problem.

    When we run

    “import xlrd” within the python3 command prompt we get this error (see also

    screenshot 0)

    ImportError:

    No module named ‘xrld’

    Beside this I

    also have to mention that we don’t use another python installation.

    We are ONLY

    using the Python version within SPSS, there is nothing else installed of python

    on the machine (see screenshot 1 and 2).

    To import the

    xlrd module, I only added the python3 path to the system environment conform

    the installation guide. (see screenshot 3).

    Hopefully

    this extra information helps us to solve this problem.

    We have screenshot but I can't insert these here. Please could you send me an email (huttemSupport Member) so I can send you this by email?

    With kind

    regards.






    #SPSSStatistics
    #Support
    #SupportMigration