Cant setup Orthanc Mammography plugin on Windows 11

Greetings,
I have been pulling my hair out trying to setup the new Orthanc Mammography plugin on Windows 11. I’m using Python 3.12.

I execute the following commands to set up the Virtual enviroment

D:\orthanc-mammography-master>python -m venv mammovenv

D:\orthanc-mammography-master>cd mammovenv

D:\orthanc-mammography-master\mammovenv>cd scripts

D:\orthanc-mammography-master\mammovenv\Scripts>activate

(mammovenv) D:\orthanc-mammography-master\mammovenv\Scripts>D:\orthanc-mammography-master\mammovenv\Scripts\python.exe -m pip install --upgrade pip

(mammovenv) D:\orthanc-mammography-master\mammovenv\Scripts>cd ..

(mammovenv) D:\orthanc-mammography-master\mammovenv>cd ..

(mammovenv) D:\orthanc-mammography-master>pip install -r requirements.txt

Add the following to my config file

"Plugins" : [ "C:\\Orthanc\\Plugins" ],

"Python" : {
    "Path" : "D:\\orthanc-mammography-master\\mammography.py"
  },
  "Mammography" : {
    "VirtualEnv" : "D:\\orthanc-mammography-master\\mammovenv\\Lib\\site-packages"
  },

Then end up with the following error in the logs

I0902 14:16:14.035659             MAIN PluginsManager.cpp:316] (plugins) Found a shared library: "C:\Orthanc\Plugins\OrthancPython-Python3.12-4.3.dll"
W0902 14:16:14.063695             MAIN PluginsManager.cpp:274] Registering plugin 'python' (version 4.3)
W0902 14:16:14.065695             MAIN PluginsManager.cpp:158] Python plugin is initializing
W0902 14:16:14.067697             MAIN PluginsManager.cpp:158] Using Python script "mammography.py" from directory: D:\orthanc-mammography-master
W0902 14:16:14.069802             MAIN PluginsManager.cpp:158] Program name: C:\Orthanc\Orthanc.exe
Downloading: https://github.com/jodogne/orthanc-mammography/raw/master/viewer/2024-08-31-StoneWebViewer-DICOM-SR.zip
  File already downloaded
I0902 14:16:15.074684             MAIN PluginsManager.cpp:162] (plugins) Registering a Python REST callback on URI: /mammography-viewer/(.*)
I0902 14:16:15.076865             MAIN OrthancPlugins.cpp:2789] (plugins) Plugin has registered a REST callback without mutual exclusion on: /mammography-viewer/(.*)
E0902 14:16:17.053895             MAIN PluginsManager.cpp:154] Error during the installation of the Python script, traceback:
<class 'OSError'>
[WinError 126] The specified module could not be found. Error loading "D:\orthanc-mammography-master\mammovenv\Lib\site-packages\torch\lib\shm.dll" or one of its dependencies.

  File "D:\orthanc-mammography-master\mammography.py", line 101, in <module>
    import model

  File "D:\orthanc-mammography-master\model.py", line 23, in <module>
    import torch

  File "D:\orthanc-mammography-master\mammovenv\Lib\site-packages\torch\__init__.py", line 141, in <module>
    raise err

E0902 14:16:17.064878             MAIN PluginsManager.cpp:92] Error while initializing plugin C:\Orthanc\Plugins\OrthancPython-Python3.12-4.3.dll (code -1)

Hello,

This kind of error is not linked to Orthanc, but to Python running PyTorch on Microsoft Windows. There are many threads regarding the same issue on Internet, for instance: Error loading "\lib\site-packages\torch\lib\shm.dll" or one of its dependencie - PyTorch Forums

I guess the first step would be to identify the missing DLL by using Dependency Walker on the D:\orthanc-mammography-master\mammovenv\Lib\site-packages\torch\lib\shm.dll shared library.

As I don’t use a proprietary operating system, I cannot provide any guidance. Maybe would it be time to try GNU/Linux?

Regards,
Sébastien-

1 Like

There are some requirements due to which I have to use Windows :frowning:

So Im now seeing the “Stone Web Viewer (for mammography)”

but when I click that button I dont get any labeled masses

That’s because you haven’t applied the deep learning algorithm on the mammogram before opening the Stone Web viewer for mammography.

You first have to click on the yellow button “Deep learning for mammography” that appears at the instance level of the study containing the mammogram. This will call PyTorch to generate the DICOM-SR instance.

Check out the figure attached to my original post.

Im getting this error…

Dear Rana,

This is always the same answer: Check out your logs.

Sébastien-

Sorry about that…log file attached
log.txt (34.2 KB)

E0903 11:41:01.186138          HTTP-10 PluginsManager.cpp:154] Error in the REST callback, traceback:
<class 'RuntimeError'>
Could not infer dtype of numpy.float32

This indicates that you manually modified the requirements.txt file to change the version of some Python libraries, resulting in an environment that is incompatible with the RetinaNet model. Again, I cannot provide any support on Microsoft Windows.