cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar

Python Integration Not Sending Data Table

Hi all, 


When running a JSL script and trying to send the variables into Python to run a script in the R console there, I get the following errors in the log: 

 

 

/**********/
# Import the numpy module for array and matrix support
import numpy as _JMPnp
/**********/
/**********/
# Import the scipy module for scientific computing support
import scipy as _JMPsp
/**********/
/**********/
# Import the pandas module for Series/Data Frame support
import pandas as _JMPpd
/**********/
Unable to import the 'numpy' Python module
Unable to import the 'scipy' Python module
Unable to import the 'pandas' Python module

x = 1;
0

This means that Python cannot read the open data from the JSL script. How do I get my data to open within Python. The JSL script is attached. 

I've even tried to change my system path to make sure it is running through anaconda: 

 

Python Submit("\[
import sys
sys.path=['', 'C:\\Users\\mikha\\anaconda3\\python38.zip', 'C:\\Users\\mikha\\anaconda3\\DLLs', 'C:\\Users\\mikha\\anaconda3\\lib', 'C:\\Users\\mikha\\anaconda3', 'C:\\Users\\mikha\\AppData\\Roaming\\Python\\Python38\\site-packages', 'C:\\Users\\mikha\\anaconda3\\lib\\site-packages', 'C:\\Users\\mikha\\anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\mikha\\anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\mikha\\anaconda3\\lib\\site-packages\\Pythonwin']
import numpy as _JMPnp
import scipy as _JMPsp
import pandas as _JMPpd
]\");

This should be really simple function in reality ... 


Thanks. 

M. Dereviankin
4 REPLIES 4
Jeff_Perkinson
Community Manager Community Manager

Re: Python Integration Not Sending Data Table

What version of JMP are you using?

-Jeff

Re: Python Integration Not Sending Data Table

JMP 15.1.0

I really don't think the version number is the issue. JMP is not initiating numpy, pandas or scipy in python so there is no way the global variables can be exported. 

M. Dereviankin

Re: Python Integration Not Sending Data Table

If you are using Python.org's Python, you also need to install numpy, scipy, and pandas Python packages. These are not installed with JMP as they are packages that need to reside in your Python environment. You may not need scipy, it's not used internally, but you do need numpy and pandas.  The code to pass data tables back and forth between Python and JSL utilize a pandas data frame. Pandas depends on numpy so both are required.  

 

using the pip ( or pip3 ) found in the directory(s) of the python you want to use with JMP

 

pip install numpy scipy pandas

Re: Python Integration Not Sending Data Table

For Anaconda, and any virtual environment you must utilize the Python Sys Path(), and Path() optional arguments to the Python Init(). (To have any reasonable chance of success).  Path is the path to the specific python3x.dll for your environment. The sys path argument takes the sys.path as a JSL list.  This should be the sys.path that you would get from the command line Python environment.  JMP 16.2 adds additional support for Anaconda on Windows by adding additional Anaconda specific library paths to JMP's LoadLibrary path.

 

The other, less recommended, way to get base Anaconda environment to work is to install Anaconda on the PATH for ALL users.  Two things that the Anaconda installer recommends not doing.  Then the modules needed would need to be installed in base, not some other virtual environment.