I am trying to run sct_deepseg_sc within a google colab notebook. I have managed to clone and install the spinalcordtoolbox and then download example data (using sct_download_data -d sct_example_data). When attempting to run sct_deepseg_sc using one of the example data files, I run into the following error:
Commands and terminal output
RuntimeError: OpenCV Error: Assertion failed (dsize.area() > 0) in resize, file /myopt/opencv/opencv-3.0.0/modules/imgproc/src/imgwarp.cpp, line 3214
OpenCV Error: Assertion failed (dsize.area() > 0) in resize, file /myopt/opencv/opencv-3.0.0/modules/imgproc/src/imgwarp.cpp, line 3214
terminate called after throwing an instance of 'cv::Exception'
what(): /myopt/opencv/opencv-3.0.0/modules/imgproc/src/imgwarp.cpp:3214: error: (-215) dsize.area() > 0 in function resize
sct_check_dependencies
Traceback (most recent call last):
File "/content/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_check_dependencies.py", line 27, in <module>
import requirements
ModuleNotFoundError: No module named 'requirements'
/content
There are a couple of issues with the installation here.
The first thing I see (from sct_check_dependencies) is that your installation is currently missing the pip dependency called requirements-parser (and if I had to guess, your installation is likely missing other requirements as well). This is because pip install -e . does not fully install SCT right now.
The “install_sct” script is the most reliable way to install SCT. However, I understand that might not be possible in a Google Colab notebook, so I’d be happy to help try and find a workaround. I’m going to try some things in the notebook to see if I can find a set of steps that works for you. I’ll respond again shortly.
Looking more closely into Google Colab, I notice that they use Python 3.7 by default. I could not find an easy way to change the Python version. (See this Colab issue for similar concerns.)
SCT relies on Python 3.6 at the moment. There is an active effort to increase support to Python 3.7 and beyond, but it is not yet ready. So, a Google Colab install of SCT is likely not possible right now. My apologies for the inconvenience.
@joshuacwnewton I am now trying to run the spinal cord toolbox in a jupyter notebook using binder. I’ve tried using install_sct, but I get an error message install_sct: command not found. Should I be able to run the install_sct command this way?
@joshuacwnewton it would be great to add this example in the installation documentation.
Actually, maybe this is not appropriate for SCT’s main installation documentation (it would be confusing for users). Now that the topic is covered in this forum topic, it can easily be found by SCT users in the futur.