Installing Orthanc Python leads to orthanc failing to start with an Error 126

Hi,

I’ve been trying to use the python plugin on an orthanc instance installed on windows.

From what’s there would I be right in saying the install process is to get the dll from the windows distribution site and place the dll in C:\Program Files\Orthanc Server\Plugins.

I attempted this but orthanc refuses to start with that dll present, printing the following to the logs:

E1006 13:27:22.926637 SharedLibrary.cpp:49] LoadLibrary(C:\Program Files\Orthanc Server\Plugins\OrthancPython-Win64-Python3.7-3.4.dll) failed: Error 126

Thanks,
Richard

Hi Richard,

If I were you, I would double check that the dll is the correct one wrt 32/64 bits and python version:

  • Check that the Orthanc you’ve installed is Orthanc 64bits
  • Check that the python installed on your system is version 3.7
  • Check that the python installed on your system is 64 bits

Best regards,

Alain.

Hi Alain,

Thanks for your help.

I tried a 32 bit version of the python library and got the message

E1007 09:11:35.347418 SharedLibrary.cpp:49] LoadLibrary(C:\Program Files\Orthanc Server\Plugins\OrthancPython-Win32-Python3.7-3.4.dll) failed: Error 193
E1007 09:11:35.347418 OrthancException.cpp:57] Error while using a shared library (plugin): You are most probably trying to load a 32bit plugin into a 64bit version of Orthanc

So I’m confident 64 bit is correct.

Going into the console and typing python prints the following

Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

So python is indeed 64 bit and version 3.7.

Does the orthanc-python get python that way? Via whatever is available globally?

Ok, looks good. Error code 126 actually means “module not found” so it seems the python plugin does not find the python dll. That might help if python is added to the PATH if not already the case.

If you feel comfortable with it, you can use ProcessMonitor to check where Orthanc is looking for the python dll. Here’s what I have on my system:
image.png

The last 2 entries are coming from my Path:

image.png

Hi Alain!

That was the hint I needed! Thank you. It seems in services that Orthanc wasn’t running under my account but under “Local System Account”, but python was in my personal user path only.

So from command prompt python was available, but the user Orthanc was running under couldn’t see python.

Either setting Orthanc to run under my user, or adding python to the global path variable solved the problem.

Thanks again!