How to configure Python for JMP 14?

Aug 15, 2018 12:29 PM(1462 views)

I'm very new to Python so this is hopefully an easy question. I have Python version 3.6 and 3.7 installed. I installed numpy, matplotlib, scipy and pdfkit in both versions. However I get errors in the log window when trying to run examples from the scripting index.

Re: How to configure Python for JMP 14?

First I want to apologize for the trouble you are having with JMP's python support. The original developer of the Python feature retired at the end of JMP 14's developemnt cycle. I am working my way through the code to fix the outstanding issues.

There are issues with JMP's ability to locate Python. If JMP finds it by itself you are good to go, usually if you only have one version of Python on your system you will be fine. When it fails, it is difficult to work around the issue in current JMP releases. Additionally there are differences between Windows and Mac in how well or how poor it is at finding Python. I have uncovered a couple of bugs in the code that is supposed to let you specify where your instance of Python is located.

Use the Python sys path( {"",...} ) within Python Init() works on JMP for Mac v14.1 or newer, but is broken on JMP 14.0, 14.1 for Windows.

Windows JMP does not handle it well if there is more than one version of Python on the system. You need to specify the version of Python to use within the Python Init ( Use Python Version("3.6")); for example to select the 3.6 version. Even with this specified you still may get errors to the log on locating modules that JMP tries to load to provide interoperability. On the Mac JMP 14.0 will have issues if there is more than 1 version of Python3. Mac JMP 14.1 fixes this by using the highest version of Python 3, rather than bailing out if there is more than one.

On my Windows 10 desktop I have installed Anaconda with Python 3.6 in my C:\local\anaconda3 directory.

The following script runs for me, even though it kicks out the warnings of not finding the modules. To solve the module loading issue, the first thing I do after the init is to import the sys module and then set sys.path to the path value that would be returned if you do the following within the python interpreter, then load those modules within my script before continuing on.

/**********/# Set the matplotlib.pyplot interactive flag to false_JMPpp.interactive(False)/**********/Traceback (most recent call last): File "<string>", line 2, in <module>NameError: name '_JMPpp' is not defined

Unable to import the 'numpy' Python moduleUnable to import the 'scipy' Python moduleUnable to import the 'pandas' Python moduleUnable to import the 'matplotlib' Python module

x1 = [1, 2, 3];x2 = [1, 2, 3];0

Tested against JMP 14.1 and current development.

Again on behalf of JMP Development, I apologize for the raw state of the Python support. Please bear with us as we continue to fix and improve this important feature. Please report problems you find and suggestions for new features.

Re: How to configure Python for JMP 14?

Of course, after I post I find a better way, but it involves setting an environment variable. JMP 14 is looking for an environment variable. It is the sys.path that I described in the previous post, however you need to set to be a JSL List of paths. On Windows 10, you need to go to system properties, Advanced System Settings, Environment Variables and create a new Environment Variable.

Re: How to configure Python for JMP 14?

Hi Paul,Thanks for your work, unfortunately I just have JMP version 13.0. And I work with Python version 3.7.1 without Anaconda.I have all the libraries needed ( numpy, scipy, matplotlib, panda... ).I am on windows 10, I did your "variable name" trick (that is well explained by the way) but with this piece of code I'm struggling...Have a look at it instead :

Re: How to configure Python for JMP 14?

The Use of a full 2-way connection to Python via a local install of Python which allows JMP to send data to Python, execute Python code from a JSL script, return data and results from Python programs, and interactively explore Python results in JMP was introduced in JMP 14.

As you have demostrated using JMP 13 (with Run Program) you can control an external program using stdin and stdout.

The comments from @Paul_Nelson are referring to the JMP 14 implementation of the full 2-way connection to Python and not via Run Program.

Re: How to configure Python for JMP 14?

I am just trying to send a datatable to Python. However, all columns end up in one string column with the actual columns separated by \t (see picture). Any idea what goes wrong here? Do you need a special pandas version (or a special matplotlib version, as this also causes an error)?

Regarding the configuration of Python it would be great if one could select a conda environment which should be used.

Re: How to configure Python for JMP 14?

You need to set your Python Init(), and/or your system environment variables, to point ot the conda installation. See the earlier responses to this community posting. There are examples of both setting the parameters withing the Python Init(), and setting environment variables to point to you python installation.