Installing SCT-7.0; Undefined symbol in ../site-packages/PyQt5/QtCore.so

Using the install script gives a undefined symbol error for shared object QtCore.so:

> ./install_sct-7.0_linux.sh

Check if pyqt5 (5.12.3) is installed................[FAIL]
An error occured while importing module pyqt5 -> /u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtCore.so: undefined symbol: _ZdlPvm, version Qt_5
Full traceback: Traceback (most recent call last):
File "/u3/SCT/sct_6.5.dev0/spinalcordtoolbox/scripts/sct_check_dependencies.py", line 364, in main
module = module_import(module_name, suppress_stderr)
File "/u3/SCT/sct_6.5.dev0/spinalcordtoolbox/scripts/sct_check_dependencies.py", line 107, in module_import
module = importlib.import_module(module_name)
File "/u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 565, in module_from_spec
File "", line 1173, in create_module
File "", line 228, in _call_with_frames_removed
ImportError: /u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtCore.so: undefined symbol: _ZdlPvm, version Qt_5

What could be the problem and how to fix it? I’m running the latest LTS version of UBUNTU-24.04.

Thank you for your help.

Jack van Asten.
(Radboud University Nijmegen, Netherlands).

Dear @Jack_van_Asten,

Thanks much for reporting this error! We’d be happy to help. :slight_smile:

The first thing I notice is that in the error log, there is mention of a secondary SCT installation (/u3/SCT/sct_6.5.dev0/ in addition to /u3/SCT/sct_7.0/). It appears that when the installer script executes the command ā€œsct_check_dependenciesā€, what actually gets run is the sct_check_dependencies script from the old sct_6.5.dev0/ installation. This is strange!

Just to double-check a few things:

  • Could you try running the following command, which will show the location of the script?
    command -v sct_check_dependencies
    
  • Then, could you try running the command:
    sct_check_dependencies
    
    This is the same command that failed during the installation. But, we’re just running it outside of the ./install_sct-7.0-linux.sh context to see if the error persists.
  • If the error still occurs, could you try temporarily renaming the folder sct_6.5.dev0 to something else? (This is just a test to see if temporarily removing the sct_6.5.dev0 folder will change how the 7.0 scripts run.)

Thank you kindly for your patience and understanding while we resolve this issue.

Kind regards,
Joshua

Hi Joshua,

Thank you very much for your quick response!

The former SCT version is still intact indeed:

which sct_check_dependencies
/u3/SCT/sct_6.5.dev0/bin/sct_check_dependencies
env |grep SCT_DIR
SCT_DIR=/u3/SCT/sct_6.5.dev0

I will run the install script install_sct-7.0_linux_into_u3_SCT.sh again with an empty environment variable SCT_DIR and changed former sct directory (to /u3/SCT/sct_6.5.dev0_).

I changed the install script slightly, to install SCT into a location that is accessible to several users at several servers.

Regards Jack.

Dear Joshua,

Unfortunately, the installation of SCT-7.0 still fails for the PyQt5 package. Again with the same ā€˜undefined symbol: _ZdlPvm’ error. See the attached ā€˜install_sct_log.txt’ file. We need this package to be able to re-label certain vertebra segmentations, in a comfortable manner.

By the way, to be able to install SCT in a custom directory, I changed this:

diff install_sct-7.0_linux.sh install_sct-7.0_linux_into_u3_SCT.sh
484c484,486
<   SCT_DIR="$HOME/sct_$SCT_VERSION"
---
>   #JvA:20241121; Install in custom directory.
>   #SCT_DIR="$HOME/sct_$SCT_VERSION"
>   SCT_DIR="/u3/SCT/sct_$SCT_VERSION"

Maybe, this would be a nice extra option to the installation script? To offer the possibility of a custom installation directory?

Thanks again in advance for your help.

Kind regards,
Jack van Asten.
(Radboud University Nijmegen, the Netherlands).

Maybe, this would be a nice extra option to the installation script? To offer the possibility of a custom installation directory?

Out of curiosity, are you running the script with the option -y? I ask because, if -y is not provided, then the script should prompt for the option to change the installation directory:

Please let me know if you don’t see this prompt!

See the attached ā€˜install_sct_log.txt’ file.

My apologies, but I don’t see any attachments. Perhaps I’m missing something, but would you be able to reupload this file?

Thanks much! :slight_smile:

Dear Joshua,

Thank you for your response.

I hope you can now receive the sct installation log file (apparently, the ā€˜upload’ button did not work):
install_sct_log.txt.gz (21.1 KB)
This is the log file, in which the Qt5 package error ā€˜undefined symbol: _ZdlPvm’ occurs.

I made some progress though, because I managed to install the toolbox on another Linux server (younger hardware, but same OS, UBUNTU-24.04.2 LTS) without any errors.

So, I guess the error message correlates with contradictory python versions? I would not expect this because the sct has it’s own python environment installed, isn’t it?

The command,
ldd /u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtWidgets.so
shows no missing libraries. Do you maybe have another way to sought this out?

Last but not least, I owe you an apology because the installation scripts indeed offers the possibility to install SCT in a custom subdirectory. I completely overlooked that.

Again many thanks for your help.

Regards,
Jack van Asten.
(Radboud University Nijmegen, the Netherlands.

–

1 Like

My apologies for the late reply! We have been busy amending the v7.0 release to fix some small QC report bugs that slipped through. I would recommend re-installing v7.0 on whichever server you end up using SCT on, just to avoid any potential QC report issues.

Regarding the ā€œUndefined symbolā€ error from the first server: Even though the same error is occurring, I think we have actually made some progress: There is now no longer any mention of the old v6.5 python environment, and all of the errors are contained within the ā€œ7.0ā€ environment.

With that solved, we can try to address the underlying PyQt error. It seems like what is happening is that the server has another version of PyQt installed system-wide, and this version is taking precedent over the version within SCT’s python environment.

To test this theory, could you try running the following command, and then try running the sct_check_dependencies command? (No need to reinstall SCT just for this part.)

export LD_LIBRARY_PATH=$SCT_DIR/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5:$LD_LIBRARY_PATH
sct_check_dependencies

This will prioritize the library files from the SCT environment over any other system files.

(Source: undefined symbol: _ZdlPvm, version Qt_5 Ā· Issue #341 Ā· cnr-isti-vclab/PyMeshLab Ā· GitHub)

If this works, then I can begin trying to find a more stable solution to this problem.

Thank you kindly for your understanding and patience,
Joshua

Dear Joshua,

Thank you for your response!

I tried the LD_LIBRARY_PATH option, but without success:

vanasten@rdbiomr:~$ export LD_LIBRARY_PATH=$SCT_DIR/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5:$LD_LIBRARY_PATH
vanasten@rdbiomr:~$ echo $LD_LIBRARY_PATH
/u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5:/opt/umcn/dcmtk/lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/libreoffice/program:/opt/ismrmrd/lib
vanasten@rdbiomr:~$ sct_check_dependencies 

--
Spinal Cord Toolbox (7.0)

sct_check_dependencies 
--


SYSTEM INFORMATION
------------------
SCT info:
- version: 7.0
- path: /mnt/umcnasclp/u3/SCT/sct_7.0
OS: linux (Linux-6.8.0-57-generic-x86_64-with-glibc2.39)
CPU cores: Available: 12, Used by ITK functions: 12
RAM: Total: 48238MB, Used: 2828MB, Available: 44832MB

OPTIONAL DEPENDENCIES
---------------------
Check FSLeyes version...............................[OK] (1.13.0)

MANDATORY DEPENDENCIES
----------------------
Check Python executable.............................[WARNING]
  Using system python which is unsupported: /u3/SCT/sct_7.0/python/envs/venv_sct/bin/python3.9
Check if acvl_utils is installed....................[OK]
Check if dipy is installed..........................[OK] (1.8.0)
Check if ivadomed is installed......................[OK] (2.9.10)
Check if matplotlib is installed....................[OK] (3.9.4)
Check if matplotlib-inline is installed.............[OK]
Check if monai is installed.........................[OK] (1.4.0)
Check if nibabel is installed.......................[OK] (5.3.2)
Check if nilearn is installed.......................[OK] (0.10.4)
Check if nnunetv2 is installed......................[OK]
Check if numpy is installed.........................[OK] (1.26.4)
Check if onnxruntime is installed...................[OK] (1.19.2)
Check if pandas is installed........................[OK] (1.5.3)
Check if portalocker is installed...................[OK] (3.1.1)
Check if psutil is installed........................[OK] (7.0.0)
Check if pyqt5 (5.12.3) is installed................[FAIL]
An error occured while importing module pyqt5 -> /u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtCore.so: undefined symbol: _ZdlPvm, version Qt_5
Full traceback: Traceback (most recent call last):
  File "/u3/SCT/sct_7.0/spinalcordtoolbox/scripts/sct_check_dependencies.py", line 363, in main
    module = module_import(module_name, suppress_stderr)
  File "/u3/SCT/sct_7.0/spinalcordtoolbox/scripts/sct_check_dependencies.py", line 107, in module_import
    module = importlib.import_module(module_name)
  File "/u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 565, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1173, in create_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
ImportError: /u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtCore.so: undefined symbol: _ZdlPvm, version Qt_5

Check if pyqt5-sip is installed.....................[OK]
Check if pystrum is installed.......................[OK] (0.4)
Check if pytest is installed........................[OK] (8.3.5)
Check if pytest-cov is installed....................[OK] (6.1.1)
Check if requests is installed......................[OK] (2.32.3)
Check if requirements-parser is installed...........[OK] (0.11.0)
Check if scipy is installed.........................[OK] (1.13.1)
Check if scikit-image is installed..................[OK] (0.24.0)
Check if scikit-learn is installed..................[OK] (1.6.1)
Check if totalspineseg is installed.................[OK] (20250205)
Check if xlwt is installed..........................[OK] (1.3.0)
Check if torch is installed.........................[OK] (2.2.2+cpu)
Check if tqdm is installed..........................[OK] (4.67.1)
Check if transforms3d is installed..................[OK] (0.4.2)
Check if urllib3 is installed.......................[OK] (2.4.0)
Check if pytest_console_scripts is installed........[OK]
Check if pyyaml is installed........................[OK] (6.0.2)
Check if voxelmorph is installed....................[OK] (0.2)
Check if wquantiles is installed....................[OK] (0.4)
Check if xlsxwriter is installed....................[OK] (3.2.3)
Check if spinalcordtoolbox is installed.............[OK]
Check ANTs compatibility with OS ...................[OK]
Check PropSeg compatibility with OS ................[OK]
Check if figure can be opened with PyQt.............[FAIL]
/u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtWidgets.so: undefined symbol: _ZdlPvm, version Qt_5
Check if figure can be opened with matplotlib.......[OK] (Using GUI backend: 'tkagg')
Check data dependency 'PAM50'.......................[OK]
Check data dependency 'deepseg_gm_models'...........[OK]
Check data dependency 'deepseg_sc_models'...........[OK]
Check data dependency 'deepseg_lesion_models'.......[OK]
Check data dependency 'deepreg_models'..............[OK]
Check data dependency 'PAM50_normalized_metrics'....[OK]
Check data dependency 'binaries_linux'..............[OK]

Total runtime; 34.996 seconds.

Most probably indeed, python versions get mixed up, because I use other python versions at our servers too;

locate QtWidgets.so gives:
/opt/anaconda3/lib/python3.5/site-packages/PyQt5/QtWidgets.so
/opt/anaconda3/pkgs/pyqt-5.6.0-py35_0/lib/python3.5/site-packages/PyQt5/QtWidgets.so
/usr/share/fsl/5.0/fslpython/envs/fslpython/lib/python3.6/site-packages/PyQt5/QtWidgets.so
/usr/share/fsl/5.0/fslpython/pkgs/pyqt-5.6.0-py36h22d08a2_6/lib/python3.6/site-packages/PyQt5/QtWidgets.so

I will reinstall sct 7.0 and see how that will go.

Regards,
Jack van Asten.

Thank you for your time and patience helping to debug this issue.

SCT should be isolated from the other Python installations, so whatever the solution to this problem, it will help improve SCT for future users as well.

I have some additional debugging steps to try based on this guide:

If some backend is installed but [SCT] still does not start, please try to start it from command line:

LD_LIBRARY_PATH="" sct_check_dependencies

If [SCT] is successfully launched after this command, it means that on your machine the LD_LIBRARY_PATH environment variable is set to a directory that contains a Qt dynamic dependency that is incompatible with the one that [SCT] uses. As linkers first search in LD_LIBRARY_PATH directories, this may cause [SCT] to crash.

Then when you identify which file is causing the problem you can use ldd command to check which libraries are used by this file:

ldd /u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtWidgets.so

Could you please try these two commands and see if it works for you?

Thank you kindly,
Joshua

Dear Joshua,

Thank you for your persistent help!

I reinstalled sct-7.0 at our Linux environment and issued the command:
LD_LIBRARY_PATH="" sct_check_dependencies

The output at the point of PyQt, now is:
…
Check if pyqt5 (5.12.3) is installed…[OK] (5.12.3)
…
Check PropSeg compatibility with OS …[OK]
Check if figure can be opened with PyQt…[OK]
Check if figure can be opened with matplotlib…[OK] (Using GUI backend: ā€˜qtagg’)
…

The command sct_check_dependencies is successful now!

Then, I ran this command with the remnant trouble maker, which WAS part of our LD_LIBRARY_PATH:
LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu" sct_check_dependencies

Now, the output was erroneous again:
…
Check if pyqt5 (5.12.3) is installed…[FAIL]
An error occured while importing module pyqt5 → /u3/SCT/sct_7.0/python/envs/venv_sct/lib/python3.9/site-packages/PyQt5/QtCore.so: undefined symbol: _ZdlPvm, version Qt_5
…

So, I think, the problem on our systems is definitely tackled now!

Sorry, for all the inconveniance. Nevertheless, I hope you can get something out of it for the awesome SCT project.

Thanks again for all your help!

With kind regards,

Jack van Asten.
Radboud University Medical Center
Nijmegen, the Netherlands.

–

1 Like

This is wonderful news! Thank you so much for sharing the results of your experimentation. :slight_smile:

The focus on LD_LIBRARY_PATH has been very informative, and actually it will have a direct impact on a different set of changes I am working on right now.

So, thank you again for raising this question and taking the time to debug! I appreciate your thorough reports and patience when solving the issue.

Kind regards,
Joshua