I've had some success with the Python integration in the past but after a recent reinstall, I'm having huge problems with getting it to work.
Configuration:
- I'm on JMP Pro 15.2 and Python 3.6.
- Just to make sure the python installation is clean, I've uninstalled it and reinstalled it. No modules other than the needed ones are installed:
- numpy, scipy, pandas, matplotlib, pyqt5 and their dependencies:
>> py -3.6 -m pip freeze
cycler==0.10.0
kiwisolver==1.3.1
matplotlib==3.3.4
numpy==1.19.5
pandas==1.1.5
Pillow==8.2.0
pyparsing==2.4.7
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
python-dateutil==2.8.1
pytz==2021.1
scipy==1.5.4
six==1.16.0
Python Init();
Python Submit( "import sys" );
Python Submit( "print(sys.version)" );
Python Term();
3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
0
With this setup I can execute:
Python Init();
x = 5;
Python Send( x );
Python Submit( "print(x)" );
Python Submit(
"\[
basket = ['apple', 'orange', 'pear']
print(basket)
]\"
);
Python Term();
As expected, I see 5.0 in the log and a 0 for Python Term():
5.0
<BR />['apple', 'orange', 'pear']<BR />
0
Now, if I push anything more than a simple number, string, or list, I get an error:
Python Init();
x = [5];
Python Send( x );
Python Submit( "print(x)" );
Python Term();
This results in the following error:
Python data type is not supported.
Almost none of the Scripting Index examples work. For example:
Names Default To Here( 1 );
Python Init();
a = "abcdef";
d = 3.141;
v = [9 8 7, 6 5 4, 3 2 1];
m = [1 2 3, 4 5 6, 7 8 9];
ml = Python Execute(
{v, m, a, d},
{x, z, a, d},
"\[
import numpy as np
a = np.multiply(v, m) # matrix product
d = np.divide(v, m) # matrix division
z = np.multiply(m, np.linalg.inv(v)) # m * inv(v) called Left division
x = np.multiply(np.linalg.inv(m), v) # inv(m) * v called right division
]\"
);
Show( v, m, ml, x, z, a, d );
Python Term();
Python data type is not supported.
Is there something I'm missing? JMP appears to be finding and sending data to Python just fine so it's not difficulties in finding the Python installation but for some reason, anything that's more than a simple python primitive don't work.
Update:
I think the problem is isolated on Python Send or Python Execute as JMP is trying to send the data to python. Creating the data in python and getting it into JMP works.
Python Init();
Python Submit("\[
df = _JMPpd.DataFrame({"Col1": [1, 2, 3],
"Col2": [4, 5, 6]})
print(df)
x = _JMPnp.array([1,2,3])
print(x)
]\");
dt = Python Get(df);
Show(dt);
dt << New Data View;
x = Python Get(x);
Show(x);
Python Term();
And it works just fine:
Col1 Col2
0 1 4
1 2 5
2 3 6
[1 2 3]
dt = DataTable("df");
x = [1 2 3];
0
In adding support for sending type bool and None, JMP 15.2 broke the send() command for any thing that followed the bool and None code, a single '}' was left out of the code. JMP 15.2.1 fixed the send functionality. Sorry for breakage, sometimes things slip through even with unit tests. ( now even more complete coverage )