I know it's as frustrating for us as it is for you. We are having a hard time replicating the issue on our machines, yet we do know there are some customers having issues. Most of our are machines are similar, with the same corporate image... One thing that is important, the bit-ness of JMP and Python must match. Because JMP loads Python as a shared library you cannot mix JMP and Python with different bit-ness. If you have 32-bit JMP you must be pointing to a 32-bit Python 3.6.1 or newer. If you have 64-bit JMP it must be a 64-bit Python 3.6.1 or newer. We found the very best chance of success if you only have a single installation of Python on your system. In JMP 14.1 if there was more than one on the system, it wouldn't even try to load Python. JMP at present is not aware of virtual enviroments.
Those having troubles please try the following option in your Python Init()
Python Init( Init Trace("TRUE") );
This option, likely not documented (sorry), will cause JMP to dump out a lot of detail on where it thinks Python is located including paths it sees and registry entries for Python that it discovers. Please include it's output when contacting tech support.
You can determine what bit-ness your running the following Python script in your environment
import struct
print( struct.calcsize("P") *8)
This should print 32 or 64 based on the bit-ness of the Python running.
Note: JMP 14 could be either 32-bit or 64-bit depending on the version. Shrink-wrap is always 32-bit
JMP 15 is only 64-bit.
I'll try to document to the fullest the Python Init() and the environment variables.
JMP 15 adds 2 new environment variables that it is looking for:
JMP_LIB_PYTHON_PATH - this is the full path to the shared library.
JMP_PYTHON_MODULE_PATH - Python's sys.path as one would expect in Windows or MacOS enviroment variables. On windows a semi-colon separated list, on MacOS a colon separated list, NOT a JSL list.
On my machine I have Anaconda 3.7.1 64-bit installed in C:\ProgramData\Anaconda3
that would look like
JMP_LIB_PYTHON_PATH=C:\ProgramData\Anaconda3\python37.dll
The path to the dll should be enough... and should be sufficient that Python Init() can be used without parameters. With the JMP_LIB_PYTHON_PATH and JMP_PYTHON_MODULE_PATH specified, Python should be fully specified even with more than one Python interpreter and Python Init() should just work.
As discussed 'Python sys path' as an environemnt variable was deprecated because it doesn't follow normal conventions for shell environment variables on either Windows or MacOS. It has spaces in the variable name and it expects a JSL list of path components { , } NOT the expected colon delimited paths on UNIX or the semi-colon delimited paths expected on Windows.
We have made an attemp to pay better attention to the Python enviroment variables PYTHONPATH and PYTHONHOME. From the Python documentation the description of these variables is:
PYTHONHOME
Change the location of the standard Python libraries. By default, the libraries are searched in
prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are
installation-dependent directories, both defaulting to /usr/local.
When PYTHONHOME is set to a single directory, its value replaces both prefix and exec_prefix.
To specify different values for these, set PYTHONHOME to prefix:exec_prefix.
PYTHONPATH
Augment the default search path for module files. The format is the same as the shell's
PATH: one or more directory pathnames separated by os.pathsep (e.g. colons on Unix or
semicolons on Windows). Non-existent directories are silently ignored.
In addition to normal directories, individual PYTHONPATH entries may refer to zipfiles
containing pure Python modules (in either source or compiled form). Extension modules
cannot be imported from zipfiles.
The default search path is installation dependent, but generally begins with prefix/lib/pythonversion
(see PYTHONHOME above). It is always appended to PYTHONPATH.
An additional directory will be inserted in the search path in front of PYTHONPATH as described above
under Interface options. The search path can be manipulated from within a Python program as the variable sys.path.
The order of precedent that JMP 15 looks for the environment variables:
Order of precedence of the Environment variables and JSL script highest to lowest
- Specfied within the JSL script in Python Init( Path(""), Use Python Version(""), Python sys path( { "",... } ), ... )
- Specified in the System/Shell Environment variables
- Auto located
- Registry, found on PATH var, or System shell to run python or conda, ... and should prefer a locally installed Python
over a system wide install Python if both exist
JMP 14
Looked first at the environment varialble 'Python sys path' which could be either the path to the dll, or the full sys.path expressed as a JSL list {"","",... }
PYTHONINSTALLPATH = the path to the top level directory containing the python installation, or the directory containing the Python shared library.
The Python Init() statement
Parameters:
Path() - The full path to the dll, or Python top level directory containing the dll.
Use Python Version() - quoted string of the major.minor python version. Often sufficient on it's own when more than one Python is found.
Python sys path() - the JSL list of quoted string paths that correspond to the Python sys.path value. Specifying these 3 should completely specify the Python installation and should override any Environment or registry values.
Init Trace("TRUE") - debugging output during JMP's Python initialization to JMP's log
Debug Print Statements ("TRUE"); - directly print the Python statements to the JMP log
Debug Print Output("TRUE"); - directly print Python output to the JMP log
JMP 14 Python Init() also optionally accepts the following: Use only one or the other, and matching the bit-ness of your JMP installation. 32-bit JMP cannot use 64-bit Python and 64-bit JMP cannot use 32-bit Python.
Use 32 Bit Python("TRUE")
Use 64 Bit Python("TRUE")
JMP 15 removed the above optional parameters since JMP 15 is 64-bit and can only use 64-bit Python. All of the parameters to Python Init() are optional, If the auto detection in the registry, or the Environment varialbles point to a valid Python, nothing further should needed in your Python Init()
Please don't hesitate to contact JMP's Technical Support, we want the Python capabilities in JMP to be useful and enhance the power that JMP provides. We want to sovle these issues so that it just works.
Paul