# Improting python script libraries in jython

**URL:** <https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350>\
**Category:** Module Development\
**Created:** [September 15, 2017, 3:35am UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350 "2017-09-15T03:35:44Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [September 15, 2017, 3:35am UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/1 "2017-09-15T03:35:44Z")

</div>

Hi,

First of all how to import external libraries (packages) in gateway or client scripts in ignition.  
Secondly can we import all python libraries (pypi) in jython?

Any help will be appreciated from scripting experts .

Regards  
Prafull

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 15, 2017, 5:58am UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/2 "2017-09-15T05:58:54Z")

</div>

The blog post at the following link says how to do that: [http://www.perfectabstractions.com/blog/new-scripting-features-in-ignition-77-part-1#external-python-modules](http://www.perfectabstractions.com/blog/new-scripting-features-in-ignition-77-part-1#external-python-modules)

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [September 15, 2017, 6:47pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/3 "2017-09-15T18:47:33Z")

</div>

Thanks for your reply nick. However my question was can I use the libraries given in Python Package Index page [PyPI · The Python Package Index](https://pypi.python.org/pypi) using "pip install package" command and how to do that.

will appreciate any expert advise on that.

regards  
prafull

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 15, 2017, 7:04pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/4 "2017-09-15T19:04:20Z")

</div>

Jython in Ignition doesn’t use any of the machinery the pypi expects for installing packages. You will have to manually install the packages you need into Ignition’s user-lib folders, and you can only install packages that have no ‘C’ dependencies.

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [September 16, 2017, 1:44am UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/5 "2017-09-16T01:44:20Z")

</div>

It’s also worth noting that you’ll need Python 2.5 versions of the libraries you import. If you find a package that only has a version for Python 2.7, look back at older versions until you find a 2.5 version. If there is none, you either need to find an alternative package, or you might try converting the 2.7 package to 2.5 which can sometimes be a painful process.

If you really want to run a 2.7 library and go through the conversion process, try just running it first. You’ll normally hit syntax errors and you’ll need to convert those lines. Dictionary comprehensions are a common item you need to convert into loops, and there are a number of other items you’ll hit as well. 2.7 libraries also often have dependencies on other 2.7 libraries, so the whole process can be quite a bit of work. Even if you don’t hit syntax errors, there’s a chance the library might not work exactly how you expect in 2.5, so be sure to test thoroughly.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [September 16, 2017, 3:14am UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/6 "2017-09-16T03:14:35Z")

</div>

Thanks turmel. I will try to manually install it in user-lib-folders of Ignition. Hope its an easy process as simple as copying the compiled byte code of python into the folder! If there is any documentation on it somewhere in Ignition it or if you can explain exact steps involved, it will be great.

prafull

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [September 16, 2017, 3:22am UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/7 "2017-09-16T03:22:05Z")

</div>

Thanks Kevin, you are a true expert on Jython scripting in Ignition. However I was wondering what prevents Ignition from supporting python 2.7 when already 3.0 has come! What is your road map for supporting the latest versions of python in Ignition ? Are they not available in Jython itself? This is especially a concern when python is getting more and more relevance in the AI world now a days and not being able to use the AI tools will be a big handicap!

Thanks again for the detailed reply once again and look forward to more details of your road map and future plan of supporting newer versions of python!

Best  
Prafull

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 16, 2017, 3:22pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/8 "2017-09-16T15:22:14Z")

</div>

Pramanj, the implementation of Python that is used in Ignition is called Jython, which works with Java. The latest version of Jython is 2.7. That is why Python 3.0 is not used with Ignition, because that version of Jython does not exist.

Ignition does not use Jython 2.7 because that only works with Java version 8 and up. People still use Ignition with Java 6 and 7 for clients so Jython 2.7 can’t be used.

Inductive Automation plans to use Jython 2.7 in Ignition 8 and up. Here is a link to the feature request (made by yours truly): [http://ideas.inductiveautomation.com/forums/255378-ignition-features-and-ideas/suggestions/7879431-upgrade-ignition-to-use-jython-2-7](http://ideas.inductiveautomation.com/forums/255378-ignition-features-and-ideas/suggestions/7879431-upgrade-ignition-to-use-jython-2-7)

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [September 16, 2017, 5:49pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/9 "2017-09-16T17:49:51Z")

</div>

Hi Nick, thanks for the update. So its safe to use Python 2.5 version of whatever libraries we are trying to use in Jython right? (till such time that Ignition version 8 is released with Jython version 2.7 or higher). I need to see what version of python do the libraries that i intend to use, use.

Thanks a lot for the clarity.

Also please explain the steps required to install the new python libraries in Ignition.

regards  
prafull

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [September 20, 2017, 5:30pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/10 "2017-09-20T17:30:56Z")

</div>

Does Ignition scripting support TCP/IP socket communication library functions? The [system.net](http://system.net) and the system.serial libraries seem to support only http get/put etc functions and rs232 serial port communication functions. How can I open a TCP/IP socket and wait for a communication with an eternal application on a separate thread ? Which library will support TCP/IP socket communication?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 20, 2017, 6:07pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/11 "2017-09-20T18:07:55Z")

</div>

I just use the native [java.net](http://java.net).\* classes.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 20, 2017, 6:08pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/12 "2017-09-20T18:08:19Z")

</div>

And java.nio.\* classes, too, of course.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [September 20, 2017, 6:17pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/13 "2017-09-20T18:17:01Z")

</div>

Where is it explained in the ignition user manuals how to use [java.net](http://java.net).\* classes. Any examples?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 20, 2017, 6:41pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/14 "2017-09-20T18:41:39Z")

</div>

It’s not in the manuals. Using anything beyond what is offered by the system.\* scripting functions is not an IA supported activity. It is an extension, a building upon the platform, made possibly by jython’s dual heritage of python and java. This would be where you search the web for java examples, and search the web for tips on accessing and extending java from jython. Consider [starting here](http://docs.oracle.com/javase/8/docs/technotes/guides/net/index.html), with the tutorials, perhaps.

---

<div class="post-metadata">

**Author:** ![vipul3164](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@vipul3164](https://forum.inductiveautomation.com/u/vipul3164)\
**Post date:** [February 27, 2019, 2:59pm UTC](https://forum.inductiveautomation.com/t/improting-python-script-libraries-in-jython/15350/15 "2019-02-27T14:59:12Z")

</div>

Can you Please tell me how can I manually install ?  
I m very new to ignition
