# NumPy Not Supported?

**URL:** <https://forum.inductiveautomation.com/t/numpy-not-supported/48910>\
**Category:** Ignition\
**Created:** [July 16, 2021, 1:56pm UTC](https://forum.inductiveautomation.com/t/numpy-not-supported/48910 "2021-07-16T13:56:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgjonaj](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@tgjonaj](https://forum.inductiveautomation.com/u/tgjonaj)\
**Post date:** [July 16, 2021, 1:56pm UTC](https://forum.inductiveautomation.com/t/numpy-not-supported/48910/1 "2021-07-16T13:56:59Z")

</div>

Good Morning Everyone,

I have a vision screen that will grab 5 points of data from a device and needs to do some number crunching. I am trying to use the code below for a best fit plane but it seems like NumPy is not recognized. Does anyone know how else this can be accomplished in Jython?

```auto
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

N_POINTS = 10
TARGET_X_SLOPE = 2
TARGET_y_SLOPE = 3
TARGET_OFFSET = 5
EXTENTS = 5
NOISE = 5

# create random data
xs = [np.random.uniform(2*EXTENTS)-EXTENTS for i in range(N_POINTS)]
ys = [np.random.uniform(2*EXTENTS)-EXTENTS for i in range(N_POINTS)]
zs = []
for i in range(N_POINTS):
    zs.append(xs[i]*TARGET_X_SLOPE + \
              ys[i]*TARGET_y_SLOPE + \
              TARGET_OFFSET + np.random.normal(scale=NOISE))

# plot raw data
plt.figure()
ax = plt.subplot(111, projection='3d')
ax.scatter(xs, ys, zs, color='b')

# do fit
tmp_A = []
tmp_b = []
for i in range(len(xs)):
    tmp_A.append([xs[i], ys[i], 1])
    tmp_b.append(zs[i])
b = np.matrix(tmp_b).T
A = np.matrix(tmp_A)
fit = (A.T * A).I * A.T * b
errors = b - A * fit
residual = np.linalg.norm(errors)

print "solution:"
print "%f x + %f y + %f = z" % (fit[0], fit[1], fit[2])
print "errors:"
print errors
print "residual:"
print residual

```

---

<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:** [July 16, 2021, 2:05pm UTC](https://forum.inductiveautomation.com/t/numpy-not-supported/48910/2 "2021-07-16T14:05:44Z")

</div>

Not supported. Numpy is really a C library with a python access API. C libraries cannot be loaded in jython because they cannot be loaded in java.

Some related topics:

> [@Your favorite Jython modules?](https://forum.inductiveautomation.com/t/your-favorite-jython-modules/16529):
>
> I’ve been wanting to import NumPy but it looks like due to this being Jython 2.5, that won’t be possible. Do you guys have any alternatives, or any other favorite modules you use in Ignition?

> [@Python, Jython, CPython, Libraries, Pip, and Python 2.7 vs 3 - A quick primer](https://forum.inductiveautomation.com/t/python-jython-cpython-libraries-pip-and-python-2-7-vs-3-a-quick-primer/43201):
>
> We wrote up a Knowledge Base article a little while back that I wanted to post here. It goes over a variety of questions that are common with regard to Python in Ignition. If you’re looking for information on the topic, take a glance at the linked article.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 16, 2021, 2:09pm UTC](https://forum.inductiveautomation.com/t/numpy-not-supported/48910/3 "2021-07-16T14:09:03Z")

</div>

If you're math saavy and depending on your Ignition version you can use the built in java math libraries to do matrix manipulations

You can use [https://commons.apache.org/proper/commons-math/javadocs/api-3.6/index.html](https://commons.apache.org/proper/commons-math/javadocs/api-3.6/index.html), check out the following thread

> [@Matrix based regression calculations for polynomial coefficients](https://forum.inductiveautomation.com/t/matrix-based-regression-calculations-for-polynomial-coefficients/24857):
>
> I am building a small project that takes test data and is suppose to use polynomial regression to calculate the coefficients of the polynomial equation. Initial searching online led me to NumPy but I know know it is not compatible with Ignition (Jython). What I’ve been given is a 6x6 matrix of the Sum of the Squares of the sample data and a 5th order poly equation. The customer has dictated that the solution is to use the Sum of Squares, the Inverse Matrix of the Sum of Squares matrix and matri…

Note you won't be able to plot using matplotlib either. You will have to transform your results into an Ignition Dataset of some sort to feed to a chart component.

---

<div class="post-metadata">

**Author:** ![bobby.miller](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bobby.miller/32/85153_2.png) [@bobby.miller](https://forum.inductiveautomation.com/u/bobby.miller)\
**Post date:** [July 15, 2026, 12:11pm UTC](https://forum.inductiveautomation.com/t/numpy-not-supported/48910/4 "2026-07-15T12:11:34Z")

</div>

You can now integrate ignition with Python 3 and use NumPy!

> **[Fluxy Public Beta Release](https://greenpipe.partners/release/fluxy%20announcement/2026-07-14)**
>
> Fluxy Public Beta Release

Here is an NumPy demonstration:

> **[Analyze Tags With NumPy](https://greenpipe.partners/docs/flux/0.1.0/fluxy/examples/numpy/)**
>
> Batch-read Ignition tags with Fluxy, calculate NumPy statistics, and write derived values back safely.
