This version of the Help is no longer updated. See JMP.com/help for the latest version.

.
Scripting Guide > Extending JMP > Working with Python > How JMP Finds Python on Windows
Publication date: 07/30/2020

How JMP Finds Python on Windows

JMP delays loading Python until a JSL-based script requires access to it. When JMP needs to load Python, it follows the standard steps for finding Python on a Windows computer:

1. JMP reads the Path() option that is specified in the Python Init() or Python Connect() function call.

2. If a Python installation cannot be found using the Windows registry, JMP looks up the PYTHONPATH environment variable, which you must have created yourself. If the environment variable is a valid Windows path, that path will be used to load the appropriate Python DLLs.

3. JMP reads the Windows registry to determine if Python has been installed. It looks at appropriate locations based on whether the installation was for an individual user or for all users on the Windows machine.

4. If the PYTHONPATH environment variable does not exist or has an invalid path, an error message appears stating that an installation of Python could not be found.

Windows: Override How JMP Finds Python

Typically, JMP determines the PYTHONHOME environment variable automatically if it is defined in the Windows registry.

Computer\<root>\SOFTWARE\Python\PythonCore\<version>\InstallPath

<root> is either the root key HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER depending on where and how you installed Python. <version> is the Python version number.

If multiple versions of Python are installed on your computer, you must specify which installation for JMP to use. You can override the location of Python as follows:

Use the Path("path to an installed Python DLL or shared library") argument with the Python Init() or Python Connect() function.

Define the PYTHONINSTALLPATH environment variable using either of the following two methods:

Method One for Changing the Default Python Install Location on Windows

Create the variable in your system environment variables using the Control Panel.

1. Select Start > Control Panel > System > Advanced system settings.

2. Click Environment Variables.

3. In the System variables pane, click New.

4. Type PYTHONINSTALLPATH for the Variable name.

5. Type the path to the Python<version>.dll file, for example:

C:/Program Files/Python/<version>/Python<version>.dll

6. Click OK and click OK again to close the System Properties window.

Method Two for Changing the Default Python Install Location on Windows

Create the variable using the Set Environment Variable() function:

Set Environment Variable( "PYTHONINSTALLPATH", "C:/Program Files/Python/Python36/Python36.dll" );

macOS: Override How JMP Finds Python

You must set the Python system paths so that all the required components can be found. In the Terminal window, enter the following boldface commands to get a string that specifies the location of the Python packages:

MDz320:~ shlori$ python --version
Python 3.6.4 :: Anaconda, Inc.
MDz320~ shlori$ python3
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)

[’’, ’/anaconda3/lib/python36.zip’, ’/anaconda3/lib/python3.6’, ’/anaconda3/lib/python3.6/lib-dynload’, ’/anaconda3/lib/python3.6/site-packages’, ’/anaconda3/lib/python3.6/site-packages/aeosa’]

In JMP, write and run the following script to specify the string that was returned:

Set Environment Variable(
"PYTHONSYSPATH",
	"\[{ "", "/anaconda3/lib/python36.zip", "/anaconda3/lib/python3.6",
        "/anaconda3/lib/python3.6/lib-dynload", "/anaconda3/lib/python3.6/site-packages",
        "/anaconda3/lib/python3.6/site-packages/aeos" }]\"
);

Test Your Setup

To test that your computer is able to run JSL scripts that use Python, run the following script:

Python Init();
Python Submit( "\[basket = ['apple', 'orange', 'pear']
print(basket)]\" );
Python Term();

You should see the following output in the log:

['apple', 'orange', 'pear']

0

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).