[Windows] OS-specific SCT installation

Hi SCT experts,

I would like to install sct on my laptop - Window 10. Unfortunately, there was some obstacles as I followed along the tutorial at (Installation for Windows - Spinal Cord Toolbox documentation) which instructed the step to run command below:

sct_testing

I got the terminal output as stated below:

================================================= test session starts ==================================================
platform linux -- Python 3.7.13, pytest-7.1.2, pluggy-1.0.0 -- /sct/python/envs/venv_sct/bin/python
cachedir: .pytest_cache
rootdir: /sct, configfile: setup.cfg
plugins: console-scripts-1.3.1, cov-3.0.0
collected 390 items / 1 error

======================================================== ERRORS ========================================================
_______________________________________ ERROR collecting testing/api/test_gui.py _______________________________________
ImportError while importing test module '/sct/testing/api/test_gui.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
python/envs/venv_sct/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
testing/api/test_gui.py:6: in <module>
    from spinalcordtoolbox.gui import base, centerline, sagittal
spinalcordtoolbox/gui/base.py:21: in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
E   ImportError: libGL.so.1: cannot open shared object file: No such file or directory
=============================================== short test summary info ================================================
ERROR testing/api/test_gui.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================ 46 warnings, 1 error in 6.04s =============================================

Would that be related to the system error? I also ran the command “sct_check_dependencies” in my terminal. The result was yield below:

SCT info:
- version: git-HEAD-45b1c1759f991332697b4120160303e963f7a3c7
- path: c:\users\chauc\spinalcordtoolbox
OS: windows (Windows-10-10.0.22000-SP0)
CPU cores: Available: 8, Used by ITK functions: 8
RAM: Total: 16301MB, Used: 8505MB, Available: 7795MB
Check Python executable.............................[OK]
  Using bundled python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] at c:\users\chauc\spinalcordtoolbox\venv_sct\scripts\python.exe
Check if data are installed.........................[OK]
Check if dipy is installed..........................[OK] (1.5.0)
Check if h5py is installed..........................[OK] (2.10.0)
Check if Keras (2.3.1) is installed.................[OK] (2.3.1)
Check if ivadomed is installed......................[OK] (2.9.5)
Check if matplotlib is installed....................[OK] (3.5.1)
Check if msvc-runtime is installed..................[FAIL]
An error occured while importing module msvc-runtime -> No module named 'msvc_runtime'
Full traceback: Traceback (most recent call last):
  File "c:\users\chauc\spinalcordtoolbox\spinalcordtoolbox\scripts\sct_check_dependencies.py", line 271, in main
    module = module_import(module_name, suppress_stderr)
  File "c:\users\chauc\spinalcordtoolbox\spinalcordtoolbox\scripts\sct_check_dependencies.py", line 103, in module_import
    module = importlib.import_module(module_name)
  File "C:\Users\chauc\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'msvc_runtime'

Check if nibabel is installed.......................[OK] (3.2.2)
Check if numpy is installed.........................[OK] (1.18.5)
Check if onnxruntime is installed...................[OK] (1.7.0)
Check if pandas is installed........................[OK] (1.3.5)
Check if portalocker is installed...................[OK] (2.4.0)
Check if psutil is installed........................[OK] (5.9.0)
Check if pyqt5 (5.11.3) is installed................[OK] (5.11.3)
Check if pytest is installed........................[OK] (7.1.2)
Check if pytest-cov is installed....................[OK] (3.0.0)
Check if raven is installed.........................[OK]
Check if requests is installed......................[OK] (2.27.1)
Check if requirements-parser is installed...........[OK]
Check if scipy is installed.........................[OK] (1.7.3)
Check if scikit-image is installed..................[OK] (0.19.2)
Check if scikit-learn is installed..................[OK] (1.0.2)
Check if tensorflow is installed....................[OK] (1.15.5)
Check if torch (1.5.0+cpu) is installed.............[OK] (1.5.0+cpu)
Check if torchvision (0.6.0+cpu) is installed.......[OK] (0.6.0+cpu)
Check if xlwt is installed..........................[OK] (1.3.0)
Check if tqdm is installed..........................[OK] (4.64.0)
Check if transforms3d is installed..................[OK] (0.3.1)
Check if urllib3 is installed.......................[OK] (1.26.9)
Check if pytest_console_scripts is installed........[OK]
Check if wquantiles is installed....................[OK] (0.4)
Check if spinalcordtoolbox is installed.............[OK]
Check ANTs compatibility with OS ...................[OK]
Skipping PropSeg compatibility check ...............[  ] (Not supported on 'native' Windows (without WSL))
Check if figure can be opened with matplotlib.......[OK] (Using GUI backend: 'QtAgg')
Check if figure can be opened with PyQt.............[OK]

Hi @Krystaly,

Welcome to the forum, and thank you for posting this issue! I appreciate that you shared detailed logs – it helps make my job easier. :slightly_smiling_face:

There seems to be 2 separate issues here:

  1. ModuleNotFoundError: No module named 'msvc_runtime'

    For this issue, I was able to reproduce the error on my own Windows machine. But, I believe the error is just a visual bug – in other words, the installation of SCT is OK.

    You can safely ignore this error. Also, we will be fixing this bug soon (see: Issue #3794).

  2. ImportError: libGL.so.1: cannot open shared object file: No such file or directory

    For this issue, I was not able to reproduce the error on my own Windows machine. So, I’d like to ask a few questions to try and debug the issue.


One thing that I noticed is that when you ran sct_testing, the error log mentions:

/sct/python/envs/venv_sct/bin/python

However, when you ran sct_check_dependencies, the log mentions:

c:\users\chauc\spinalcordtoolbox\venv_sct\scripts\python.exe

Because of this, there seems to be 2 separate installations of SCT in 2 different locations: one in the /sct folder, and the other in the c:\users\chauc\spinalcordtoolbox folder.


So, just to make sure, I have 2 questions:

  1. Have you installed SCT multiple times? (For example, once using Docker/WSL, and once using install_sct_5.6.bat?)

  2. Could you please run the following command in a Command Prompt window, then share the output?

    where sct_testing
    

Thank you kindly,
Joshua

Hi,

I also had the error that msvc-runtime was not installed
Check if msvc-runtime is installed…[FAIL]
An error occured while importing module msvc-runtime → No module named ‘msvc_runtime’
Full traceback: Traceback (most recent call last):

  • File “c:\users\buechel\spinalcordtoolbox\spinalcordtoolbox\scripts\sct_check_dependencies.py”, line 271, in main*
  • module = module_import(module_name, suppress_stderr)*
  • File “c:\users\buechel\spinalcordtoolbox\spinalcordtoolbox\scripts\sct_check_dependencies.py”, line 103, in module_import*
  • module = importlib.import_module(module_name)*
  • File “C:\Users\buechel\AppData\Local\Programs\Python\Python37\lib\importlib_init_.py”, line 127, in import_module*
  • return _bootstrap._gcd_import(name[level:], package, level)*
  • File “”, line 1006, in _gcd_import*
  • File “”, line 983, in _find_and_load*
  • File “”, line 965, in _find_and_load_unlocked*
    ModuleNotFoundError: No module named ‘msvc_runtime’

You simply need to activate the sct env (in may case)
c:\Users\buechel\spinalcordtoolbox\venv_sct\Scripts>activate

and then use pip to install the package
pip install msvc-runtime

This fixes it.

Hope that helps

Christian

1 Like

Thank you for providing a clear solution / answer, @cbuechel.

This fix will be included in the next release of SCT, as well. :slight_smile:

Kind regards,
Joshua