Install user library


I want to install this library pythonnet below. Actually I want to call a .net dll library in a pyhon script. So after some search, I found this library but having difficulty installing this pythonnet library.

I followed the steps that are mentioned in this forum post below. I was able to create a junction link between ignition library directory and jython library directory.

But I am having difficulty installing the library in jython using pip. What commands should be ran?

I also tried using python command but still getting errors as shown in screen capture below. How this error can be fixed?

I also tried copying the library folder in this directory C:\Program Files\Inductive Automation\Ignition\user-lib\pylib. But still getting import error in script.

Appreciate any help.

Fairly certain that is CPython and you won’t be able to use it with Jython/Ignition.

1 Like

If the file for a given pypi package includes a build phase, that pretty much always means part of the package is written in C. This will not be jython-compatible. So too for any dependencies automatically pulled in by a package.

Key graf from the knowledgebase article:

Because Ignition’s Python interpreter is Jython, that means unlike CPython, Java libraries are accessible. It also means C libraries aren’t accessible.

{ Emphasis added. }

1 Like

As folks have mentioned, that library won’t be available in Ignition’s Python environment (Jython), since it’s a CPython library.

For your overall goal, the most popular ways to invoke DLLs from Ignition:

Option 1: Run CPython next to Ignition. See the " Can I run Python 3 code from Ignition?" section from the article WillMT10 linked.

Option 2: Create an Ignition module that calls that library using JNA. An example module exists that you can download and use as a starting point.
GitHub Ignition JNA Example
Note that if it’s a pure .NET library that doesn’t have C linkage, you might need to go through a few steps first, as mentioned in the readme.


Thank you all for your help and for sharing useful article and information. I will try the 2 options that are mentioned.