# Added python libraries via python and pip

**URL:** <https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242>\
**Category:** Ignition\
**Created:** [October 14, 2022, 5:41pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242 "2022-10-14T17:41:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 5:41pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/1 "2022-10-14T17:41:17Z")

</div>

Does anyone have experience with adding a python module via installing python and pip? I am looking to use the pyauogui library in order to take a screenshot. I am assuming this isn't a standard library to use? If I go ahead and install python, then pip, and install this package can I call this function within a script without having to do anything else?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 14, 2022, 5:45pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/2 "2022-10-14T17:45:28Z")

</div>

This article talks about using pip and external libraries: [https://support.inductiveautomation.com/hc/en-us/articles/360056397252-Python-In-Ignition](https://support.inductiveautomation.com/hc/en-us/articles/360056397252-Python-In-Ignition)

That said, you don't need an external library to take a screenshot. Just use the java.awt.Robot API.

> [@Print to Image](https://forum.inductiveautomation.com/t/print-to-image/4767/6):
>
> If you feel like getting your hands dirty, you might be able to use your handy mechanical friend, java.awt.robot, to do this for you. Note: This is pretty advanced, as it digs into the Java API. Full Code: # Capture Test from java.awt import Robot, Toolkit, Rectangle from java.io import File from javax.imageio import ImageIO robot = Robot() toolkit = Toolkit.getDefaultToolkit() dimension = toolkit.getScreenSize() bufferedImage = robot.createScreenCapture(Rectangle(0, 0, dimension.width, di…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 14, 2022, 6:06pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/3 "2022-10-14T18:06:33Z")

</div>

Or possibly [`system.print.createImage`](https://docs.inductiveautomation.com/display/DOC81/system.print.createImage), depending on exactly what you're trying to do.

Note that you simply cannot take/request screenshots/render **Perspective** content into an image at this time. _All_ scripting solutions will only work in Vision.

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 6:24pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/4 "2022-10-14T18:24:22Z")

</div>

I currently have everything setup in perspective. There is no way to take a screenshot using scripting in perspective at all? Even with importing something like selenium library? Since perspective is run on a web browser I would think this would work:. Here is the link I found for something that does this:

> **[Take screenshot of any webpage (URL) using Python - CodeSpeedy](https://www.codespeedy.com/take-screenshot-of-any-webpage-url-using-python/#:~:text=Steps%20how%20to%20take%20a%20screenshot%20of%20any,function%20to%20open%20the%20URL.%20...%20More%20items)**
>
> With the help of selenium Python library we can able to take screenshots of any webpage (URL) using Python.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 14, 2022, 6:26pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/5 "2022-10-14T18:26:02Z")

</div>

No, not possible at the moment. All Python code runs on the backend, and there's no facility for providing or running code on the front end, except for developing your own custom module.

It's been discussed as a possible feature some day but nothing has changed AFAIK: [https://forum.inductiveautomation.com/t/perspective-screenshot-capture/](https://forum.inductiveautomation.com/t/perspective-screenshot-capture/)

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 6:38pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/6 "2022-10-14T18:38:22Z")

</div>

Once a day I need to take a screenshot of one screen and send it in an email to someone. This stinks. Looks like I will have to recreate everything I did in perspective over to vision now.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 14, 2022, 6:40pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/7 "2022-10-14T18:40:56Z")

</div>

You _can_ use an external tool like Selenium to capture a screenshot of Perspective. You just can't do it from within Ignition by dropping in a Python library. You would have to set up a Python environment, Selenium and a web browser "driver".

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 6:42pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/8 "2022-10-14T18:42:51Z")

</div>

That stinks. Will have to recreate everything in vision now. Please tell me you are able to send emails through scripting in vision?!?! I am using Ignition Edge and once a day need to send a screenshot of one screen and also create a csv file with data saved to the internal database due to Edge.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 14, 2022, 6:43pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/9 "2022-10-14T18:43:04Z")

</div>

Check the " **Can I run Python 3 code from Ignition?**" section of the article Kevin linked above.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 14, 2022, 6:44pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/10 "2022-10-14T18:44:34Z")

</div>

You can send emails from Vision, yes. Assuming you have an SMTP server available to you. And assuming your Ignition Edge has the "compute" plugin for scripting (I think...?).

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 14, 2022, 6:48pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/11 "2022-10-14T18:48:50Z")

</div>

But yeah, if you don't need to take a screenshot of a screen you're currently looking at, invoked by a button press or whatever, then you may be able to salvage the work you've already done by pointing Selenium or something at the right project/page and using it to get a screenshot, like Paul is suggesting.

Basically a poor man's scheduled report, by the sound of it.

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 7:04pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/12 "2022-10-14T19:04:50Z")

</div>

I will have the Compute plugin. Creating a bottle or flask from the article definitely seems a bit over my head and complicated. If I am able to process the commands directly from Ignition versus having other things running in the background and making things more complicated, as much as it sucks, I will probably be better off recreating in vision versus setting up things I don't have experience doing.

For the screenshot I simply have to take one picture of the screen in the morning, automatically at a certain time, and send in an email. I also have to create a csv file with values from the internal history throughout the day and send that as well.

Does this all seem possible in vision with the compute module?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 14, 2022, 7:06pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/13 "2022-10-14T19:06:50Z")

</div>

Yes, and before you do any work actually building the screen you can play around with code from the other post to take a screenshot and test sending an email, to verify this all works.

I assume you realize this means having a Vision client open and running 24/7 on some computer somewhere so that it can actually take the screenshot and send it.

---

<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:** [October 14, 2022, 7:21pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/14 "2022-10-14T19:21:37Z")

</div>

> [@Kevin.Herron](#):
>
> running 24/7 on some computer somewhere

He's using Edge, so presumably Edge panel. Running Vision 24/7 would be pretty common.

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 7:26pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/15 "2022-10-14T19:26:53Z")

</div>

Yes I am using Panel so it would be available 24/7

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 8:57pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/16 "2022-10-14T20:57:59Z")

</div>

Is there a way to send an email with a few files created without having to go down the route of installing python, then pip, then installing the package? In otherwords if I used vision can I get around having to do this with a function already available within ignition?

---

<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:** [October 14, 2022, 9:07pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/17 "2022-10-14T21:07:42Z")

</div>

Yes, Vision client scripts can use [system.net.sendEmail()](https://docs.inductiveautomation.com/display/DOC81/system.net.sendEmail). (See the "Scope" statement in the doc.)

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [October 14, 2022, 9:54pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/18 "2022-10-14T21:54:00Z")

</div>

So just to come back around...there is no way to do a screenshot unless you install python, pip, a package that would do it, create a script with the external python folder, and then call that script somehow within ignition. with vision you can use the above example to take a screenshot of a vision window without having to install python...etc. As far as the email goes the system.net.sendEmail can be used for either perspective or vision.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 14, 2022, 9:58pm UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/19 "2022-10-14T21:58:49Z")

</div>

Yes, I would say that's an accurate summation.

Perspective is, fundamentally, subject to the privileges and restrictions of the browser environment.  
Pros are no installation time, zero update lag, and compatibility with a huge range of devices.  
Cons are the browser sandbox - because the last 3 decades have shown time and time again that any capability web browsers expose is a capability someone will exploit for malicious purposes.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [October 15, 2022, 4:58am UTC](https://forum.inductiveautomation.com/t/added-python-libraries-via-python-and-pip/65242/20 "2022-10-15T04:58:09Z")

</div>

When someone asks for scheduled emails, I've found web-accessible Perspective reports (#2 & 3 below--not reporting module, just views of desired data, and often a download button to get it in Excel) are generally an appreciated upgrade. Some ideas that may or may not be relevant to your use case:

1. I'm not sure what the desired screenshot shows, but if there's a way to present the required data textually, a simple email would be easy from Edge.

2. If your Edge system is connected to a central server, you could take a daily record of the data behind what's on that screen instead of the screenshot. This data could be used to recreate a view like the daily screenshot available on demand from the central server via Perspective app. And it would support other uses of the data too.

3. Even without a central server, I believe Edge Compute would supply the necessary tools to store the daily data in a dataset tag or other format on local file system. If local Edge client is Perspective Workstation (not browser), last I heard you can connect one remote Perspective client too, which would allow viewing the daily reports in your Perspective app.
