Environment variables on the MacFrom which file are these read? I'm trying to set PYTHONINSTALLPATH without having to use jmpStart.jsl
Re: Environment variables on the MacIf only it were that simple
Re: Environment variables on the MacI'm just going to leave this here:
https://xkcd.com/1987/Re: Environment variables on the MacRe: Environment variables on the Mac@Dan RE:crash on window close
This is edited from the scripting index. It runs and closes OK without a crash.
Python Init();
ml = Python Submit(
"\[
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show(block=True)
]\"
);
plot = Python Get Graphics( png );
pngJMP = New Window( "Plot", Picture Box( plot ) );
Python Submit( "plt.close()" );
Python Term();
wait(1);
pngJMP << Close Window;
Like Don, I have to run this first so that Python Init(): will work
Set Environment Variable(
"PYTHONINSTALLPATH",
"/Library/Frameworks/Python.framework/Versions/3.6/Python"
);
Re: Environment variables on the Macthe matrix issues might have to do with formatting?
for example in JMP a simple matrix is easy
x=[1 2 3, 4 5 6, 7 8 9 ];
in numpy its an array
x = numpy.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
So, in order to submit a matrix as a numpy array we have to translate the jmp matrix
q="new = numpy.array ([";
for (i=1, i<=nitems(xx), i++,
zz=matrix(xx[i]);
q=q||char(zz)||",";
);
q=q||"])";
show(q);
python submit(
"import numpy
"||q);
python submit("print(new)");
Re: Environment variables on the MacMatplotlib isn't loading, so I'm wondering if JMP stops loading modules at this point and no further "apps" are loaded?
Set Environment Variable(
"Python sys path",
"{\['', '/anaconda3/lib/python36.zip', '/anaconda3/lib/python3.6', '/anaconda3/lib/python3.6/lib-dynload', '/Users/bywing/.local/lib/python3.6/site-packages', '/anaconda3/lib/python3.6/site-packages', '/anaconda3/lib/python3.6/site-packages/aeosa', '/anaconda3/lib/python3.6/site-packages/IPython/extensions', '/Users/bywing/.ipython'']\}"
);
Set Environment Variable(
"PYTHONINSTALLPATH",
"/Library/Frameworks/Python.framework/Versions/3.6/Python"
);
Python Init();
I only see this message the first time I do Python Init();
Python Error: Type=<Null> Value=<Null>
Traceback:
<Null>
# Import the matplotlib.pyplot class
import matplotlib.pyplot as _JMPpp
Unable to import the 'matplotlib.pyplot' Python module
1
Matplot works in IDLE and in iPython Jupyter Notebooks so I'm pretty sure its there.
>>addition<<
I think I got a typo in the instructions I posted above
Set Environment Variable(
"Python sys path",
"{\['', '/anaconda3/lib/python36.zip', '/anaconda3/lib/python3.6', '/anaconda3/lib/python3.6/lib-dynload', '/Users/bywing/.local/lib/python3.6/site-packages', '/anaconda3/lib/python3.6/site-packages', '/anaconda3/lib/python3.6/site-packages/aeosa', '/anaconda3/lib/python3.6/site-packages/IPython/extensions', '/Users/bywing/.ipython'']\}"
);
Does not work; however, replacing the argument "Python sys path" with "PYTHONSYSPATH" does work.
The Matplotlib still doesn't load, but this works to start python all on its own.
Set Environment Variable(
"PYTHONSYSPATH",
"{\['', '/anaconda3/lib/python36.zip', '/anaconda3/lib/python3.6', '/anaconda3/lib/python3.6/lib-dynload', '/Users/bywing/.local/lib/python3.6/site-packages', '/anaconda3/lib/python3.6/site-packages', '/anaconda3/lib/python3.6/site-packages/aeosa', '/anaconda3/lib/python3.6/site-packages/IPython/extensions', '/Users/bywing/.ipython'']\}"
);
Re: Environment variables on the MacI am also seeing the same behavior. In addition, I can't use Python Send() with matrices
Python Error: Type=<NULL> Value=<NULL>
Traceback:
<NULL>
# Read a binary file containing doubles into an ndarray
M = _JMPnp.fromfile("/private/var/folders/_2/r89cbthx21z_119tqk3gj_60000zwg/T/D306A68B-5AE1-44EB-A195-91A8243FE678", dtype=_JMPnp.float64, count=-1, sep="")
Python Error: Type=<NULL> Value="name 'M' is not defined"
Traceback:
<NULL></NULL></NULL></NULL></NULL></NULL>
or Python Get() with data tables
Python Error: Type=<Null> Value=<Null>
Traceback:
<Null>
# Import a JMP exported .csv file into a Data Frame
dt = _JMPpd.read_csv("/private/var/folders/_2/r89cbthx21z_119tqk3gj_60000zwg/T/2083EEE7-0EC0-4547-80E2-0D1E9B6EA3A2.dat")
Python Error: Type=<Null> Value="name 'dt' is not defined"
Traceback:
<Null>
print( dt )
-1Re: Environment variables on the MacI am able to get matplotlib to load with the attached script, however when you try to close the figure1 window, JMP crashes.
See if anyone else is getting this behavior.
Re: Environment variables on the Macas a side note:
I can gets things with numpy and pandas to work.
Set Environment Variable(
"PYTHONINSTALLPATH",
"/Library/Frameworks/Python.framework/Versions/3.6/Python"
);
//passing strings works
Python Init();
Python Submit( "\[
str = "The quick brown fox jumps over the lazy dog";
]\" );
getStr1 = Python Get( "str" );
getstr2 = Python Submit( "print(str)" );
getstr3 = Python get( "print(str)" );
Show( getStr1, getstr2, getStr3 );
Python Term();
//basic math works
Python Init();
x = 4;
y = 3;
Python Send( x );
Python Send( y );
Python Submit( "print(x)" );
Python Submit( "print(y)" );
Python Submit( "z=x+y" );
Python Submit( "print(z)" );
Python Term();
put some data on the clipboard=expr(
dt=open("$Sample_Data\Big Class.jmp",invisible);
dt<< Bring Window To Front;
main menu("Select All");
main menu("Copy with Column Names")
);
//pandas works
put some data on the clipboard;
mla = python submit(
"\[
import pandas as pd
df=pd.read_clipboard(sep='\\s+')
size= (df.height * df.weight)/df.age ** .5
pddfmw1= df["weight"].mean()
pddfmw2= df.weight.mean()
]\"
);
Python Submit( "print(pddfmw1)" );
Python Submit( "print(pddfmw2)" );
//things with numpy work
put some data on the clipboard;
mlb = python submit(
"\[
import numpy as np
df=pd.read_clipboard(sep='\\s+')
npdfmw1= np.mean(df.weight,axis=0)
npdfmw2= np.mean(df.weight)
]\"
);
Python Submit( "print(npdfmw1)" );
Python Submit( "print(npdfmw2)" );Re: Environment variables on the MacDon,
Huge thanks, this was the missing piece.
I uninstalled all the python 3 and anacond on my mac. Then I did a reinstall of the 5.1 anaconda distribution.
After the installation I had to update the anaconda installation as well as a couple of the packages
Then using the phthoninstallpath example you posted, I worked, I could connect to python.
Thanks!
JMP still can't find matplotlib. It works in Jupyter notebook, and IDLE (terminal window) but not with JMP
In your JMP/python can you "import matplotlib.pyplot as plt" without an error?
Re: Environment variables on the MacI don't want to have to set any of this is in JMP. I want to set PYTHONINSTALLPATH permanently in the OS and have it persist over JMP sessions. If I could find the file that JMP reads to get the environment variables, I think I could put it there.
Re: Environment variables on the MacIf you prefer, you can include this path in your Python Init() call so you don't need to re-run the Set Environment Variable() everytime. However, it will make it less flexible for sharing with others.
Python Init( Path( "/Library/Frameworks/Python.framework/Versions/3.6/Python" ) );
Re: Environment variables on the MacThis didn't work for me. However, this did
Set Environment Variable(
"PYTHONINSTALLPATH",
"/Library/Frameworks/Python.framework/Versions/3.6/Python"
);
Unfortunately, I have to rerun it everytime I start JMP.
Re: Environment variables on the MacI moved the Anaconda-Navigator alias, anaconda3 folder, and AnacondaProjects folder to the trash and rebooted. Can't remember exactly where all were located (outside of the Applications folder) but you might check the /Library/Frameworks folder
Re: Environment variables on the MacCould one of you post some instructions on what steps you did to completely remove python (I've got the OSX version and Anaconda on this machine)
Re: Environment variables on the MacYes, I sent this to Sheila yesterday -- it was a response from Kyoko about how to get Python working on the Mac. I noted that there was no information in the JMP 14 doc specific to getting it to run on the Mac, only Windows.
I have been working on this problem as well. I uninstalled all of my Anaconda versions and just installed the vanilla 3.6.5 from python.org.
Then in a terminal window I typed python3 and then import sys and then print (sys.path).
To get the python packages installed, I had to use pip -a install PACKAGE.
This was the JSL I had to run:
Set Environment Variable(
"Python sys path",
"{'', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages'}"
);
Then Python Init(); worked returning 0.
Re: Environment variables on the MacI think I might be working on the same problem. I just got this note from Sheila Loring (below). This didn't work for me, but I'm in the process of wiping all the python 3 and anaconda folders from my mac so I can start over from scratch. Maybe that will work?
-----------------------------
On my Mac (High Sierra), I installed Python from Anaconda.
In terminal window:
MDa118:~ saskut$ python --version
Python 3.6.4 :: Anaconda, Inc.
MDa118:~ saskut$ 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']
Also Jeff Polzin said that the following Python packages must be installed. Some installs of Python may not install these for the user:
numpy, scipy, pandas, sqlite3, PyQt5, Matplotlib
Users must use the correct “pip” tool for their installation. The “pip” tool name is dependent on the what product has installed Python. The installation instructions for Python should have instructions on how to do this.
In JMP 14.1.0 (2018.04.03 Release) on High Sierra, bring up a script editor and paste and execute the following JSL:
Set Environment Variable(
"Python 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/aeos\!" }"
);
Once you have done this then try running examples in the Scripting Index.
------------------------------------------------------------------------------------------------------------------------------------
OK, so this doesnt work.
Set Environment Variable("Python sys Path", ... I'm pretty sure this is wrong
Its supposed to be:
Set Environment Variable("PYTHONSYSPATH", ...
When I tried the all caps, no spaces version, then python would run just like useing the installpath method.
Using both syspath and install path didn't work to get matplot loading