Why is nightly build looking for local config?

I compiled our extension, SlicerPathology, on Linux. The Linux nightly build, when you use the SlicerPathology extension, gives the following error message in the Python Interactor:

[GCC 4.6.4] on linux2
>>> Current SlicerOpenCVSelfTest.py path = 
Trying to import cv2
Trying to import from file
Full path not found:  /home/superbear/.config/NA-MIC/Extensions-25933/OpenCV-build/lib/cv2.so
Loading cv2 from  cv2.so
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/superbear/.config/NA-MIC/Extensions-25933/SlicerOpenCV/lib/Slicer-4.7/qt-scripted-modules/SlicerOpenCVSelfTest.py", line 36, in <module>
    cv2 = imp.load_dynamic('cv2', cv2File)
ImportError: ./cv2.so: cannot open shared object file: No such file or directory

ok, that’s embarrassing. Why is it looking for this .config directory in my local home directory? How do I fix it?

Extensions are installed in your local home directory, so normally they are loaded from there. Don’t you have SlicerOpenCVSelfTest.py in your local home directory?

While you are developing the extension you should be able to load it from your build tree. Try specifying --launcher-additional-settings (.ini file in your build tree) when you start Slicer.

On Linux (and Windows) the extension install directory is under HOME because it needs to be writable by the user, whereas the Slicer install directory is often read-only (e.g. C:\Program Files).

From a quick look at the package, it appears that there are some hard-coded loader paths which would need to be adjusted. imp.load_dynamic('cv2', SO_PATH) succeeds on my linux vm (where SO_PATH is the full path to cv2.so).

This error comes from exposing of OpenCV functionality into Python. This was added by Nicole Aucoin, who is no longer working on this project. I remember she was saying that this error message is harmless.

Hi Andrey,

Thanks. I was wondering how it got there. It’s harmless but if anybody besides us downloads this, and if they’re reading carefully, there’re gonna wonder who the heck user ‘superbear’ is. So… I have to ask… does anybody else there know about the opencv integration, or how to get around the hard-coding that was implemented?



“superbear” must be the user name on your platform.

The reason it refers to your config file is because when you install an extension, that extension is installed on your computer in a specific location, and config file must be updated to point to that directory.

There is no hard-coded reference to “superbear” anywhere in the code, see https://github.com/sbu-bmi/SlicerOpenCV.

I do agree however that the error message is misleading. Perhaps we should remove indications that Python integration of OpenCV is working, since it has never been verified by anyone.

This error message should not affect your work, since you use SlicerOpenCV from C++, not from Python.

I disabled Python-OpenCV test to get rid of this misleading error message:


If OpenCV + python is needed, the new changes to support SlicerRadiomics should help. Let me know if it become an issue again.

1 Like