Getting Access to Python Plugin in Windows Service

158 views
Skip to first unread message

Yogesh Rao

unread,
Dec 15, 2022, 8:12:41 AM12/15/22
to Orthanc Users
When I start the windows service without using python plugin, the Orthanc perfectly starts as a service. Below is the configuration when it runs perfectly fine:

Screenshot_20221215_183847.png

But as soon as I add the python plugin, Orthanc fails to start as a service. Below is the configuration for the same:
Screenshot_20221215_183858.png

I guess, Orthanc is unable to access the Python interpreter. Could you please help me with this problem.

Thank you so much in advance!

Alain Mazy

unread,
Dec 16, 2022, 4:04:18 AM12/16/22
to Yogesh Rao, Orthanc Users
Hi,

First, make sure you have followed all recommendations from here:

Beware that one version of the Python plugin can only be run against one version of the Python interpreter. This version is clearly indicated in the filename of the precompiled binaries.

Pay also attention to pick the right 32/64 bits version. If you are running Orthanc 64bits, install Python in 64bits and select the 64bits Python plugin too.

When you install Python on your Windows machine, make sure to install Python for All Users and select the Add Python to Path option.


Then, check your logs for errors and share your logs.

Best regards,

Alain.


--
You received this message because you are subscribed to the Google Groups "Orthanc Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orthanc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orthanc-users/956d0815-3dbd-455b-80c9-0f50782a828dn%40googlegroups.com.

Yogesh Rao

unread,
Dec 16, 2022, 4:11:32 AM12/16/22
to Alain Mazy, Orthanc Users
Hi Alain,

I have made sure all the points you have mentioned:
  • I have installed Python for all users
  • It's 64 bits
  • Checked add to Path option while installation
  • Orthanc version is 4.0
  • Python version is 3.8.10
  • Python Plugin which I have downloaded is OrthancPython3.8-4.0.dll which is the compatible one
And like I already said, it runs perfectly fine when I operate it from my terminal using command "Orthanc.exe configuration.json"

It doesn't work as expected when we start it as windows service. For running the service, I have used nssm.exe.

Paths of nssm.exe have been configured and that also works fine if I run manually but again fails when I run as a service!

Quick response will be appreciated. Thanks!

Alain Mazy

unread,
Dec 16, 2022, 4:15:47 AM12/16/22
to Yogesh Rao, Orthanc Users
Then you should use ProcessMonitor to check what's going wrong.  Please share your findings to help future visitors.

Shoaib Hussain

unread,
Dec 16, 2022, 4:27:28 AM12/16/22
to Orthanc Users
Can you please check if the user you are running orthanc manually and the one starting the orthanc service are same.

Try this -
- open terminal/cmd and type python -V
- note down python version 

Now open terminal as admin and 
- python -V
- note down python version

Are both python versions same and matching your python plugin version ?

Yogesh Rao

unread,
Dec 16, 2022, 4:31:14 AM12/16/22
to Shoaib Hussain, Orthanc Users
I really appreciate the response but unfortunately that doesn't help. I have checked the Orthanc command in noth manual process and in service, they are both.

Also the python versions are the same for user as well as admin. Also I have only one version of Python installed in my system which is 3.8.10. Attaching ss for your reference!

Screenshot_20221216_145348.png

Screenshot_20221216_145409.png

Please help if you have some other things/solutions on mind!

You received this message because you are subscribed to a topic in the Google Groups "Orthanc Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orthanc-users/axrJfgA-Enk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orthanc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orthanc-users/4e27c715-0f6f-4a22-967e-18da8c28d332n%40googlegroups.com.

Alain Mazy

unread,
Dec 16, 2022, 4:33:20 AM12/16/22
to Yogesh Rao, Shoaib Hussain, Orthanc Users
FYI, here's the kind of output you may get with ProcessMonitor that would help you diagnose what goes wrong when loading the python plugin (here, I intentionally prevented access to the dll for the SYSTEM user)

image.png

Yogesh Rao

unread,
Dec 16, 2022, 4:53:42 AM12/16/22
to Alain Mazy, Shoaib Hussain, Orthanc Users
Hi Alain,

That really helped me check the process for the service. I am still not familiar, how do I figure out the exact problem because all I see is success and NAME_NOT_FOUND. Attaching screenshot for your reference!

Screenshot_20221216_152115.png

Alain Mazy

unread,
Dec 16, 2022, 5:04:49 AM12/16/22
to Yogesh Rao, Shoaib Hussain, Orthanc Users
Filter on Orthanc.exe process and check for DLL loading.  Like shown in my screenshot.

Benjamin Golinvaux

unread,
Dec 16, 2022, 5:56:59 AM12/16/22
to Orthanc Users
Different users can lead to wildly different runtime environments.

My advice would be to check if the service works fine when run as the same BadBoy (cool user name btw) user. Google for "change windows service to run as user"

Example: https://docs.microfocus.com/SM/9.61/Hybrid/Content/serversetup/tasks/configure_the_service_manager_service_to_run_as_a_windows_user.htm

The service is run as the SYSTEM account, which has some limitations, and its `PATH` is probably different from the `BadBoy` user. 

That would be investigation step #1 if I were you.

Yogesh Rao

unread,
Dec 18, 2022, 12:24:57 AM12/18/22
to Benjamin Golinvaux, Orthanc Users
Thanks Benjamin and Alain! Those resources really helped me gain more knowledge towards Orthanc and windows services.

However, I got to know, it was the firewall which was creating the issues.The process and the steps were followed perfectly fine!

Thanks Benzy for mentioning the user name. I hope this thread helps more users on the platform. Cheers!

Sébastien Jodogne

unread,
Dec 20, 2022, 2:13:36 AM12/20/22
to Orthanc Users
Hello,

For reference, I have added this information to the Orthanc Book:

Regards,
Sébastien-
Reply all
Reply to author
Forward
0 new messages