cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar

How to install Python Packages manually on JMP

Hello,

 

I have a JMP add-in where I call Python (integrated into JMP, as I am using JMP 18.2.2) and I need to install Python packages (if they are not already installed).

 

I therefore have two questions:

 

- I don't have an internet connection, so I can't use pip install or jmp.utils to install the Python packages. How can I get Python packages hard-coded into the add-in in JMP and install them?

- Can I see if it's already installed, and if so, avoid reinstalling it?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Eki
Eki
Level I

Re: How to install Python Packages manually on JMP

Hello!

Yes, sys.executable returns the path of jmp.exe instead of the Python executable which is actually located in the same directory (jmp_python.exe). But it is difficult to use it directly as some environment variables must be set before running pip.

What you could do would be to allow JMP to generate the jpip.bat file for you. This file sets all the environment variables needed in order to the pip module of JMP-Python to work properly.

Python Create JPIP CMD();

After generating the jpip.bat file (must be done only once, obviously), you can use it with additional arguments in a JSL script like this:

Run Program(Executable("cmd.exe"), Options({"/c", "\!"path/to/the/jpip.bat\!"", "install", "--no-index", "--find-links=\!"path/to/the/wheels\!"", "numpy", "pandas", "scipy"}), Read Function("text"));

Note the escaped quotation marks, your paths might contain spaces.

Alternatively, you can modify the jpip.file directly (2nd last row):

"C:\path\to\the\jmp_python.exe" -m pip install --no-index --find-links="path\to\the\wheels" numpy pandas scipy

Then you need to run the jpip.bat file only:

Run Program(Executable("cmd.exe"), Options({"/c", "\!"path/to/the/jpip.bat\!""}), Read Function("text"));



View solution in original post

3 REPLIES 3

Re: How to install Python Packages manually on JMP

Currently I have done the following:
SophieCuvillier_2-1756455654510.png

 


 

strPathPythonLibs =  "C:\Users\Utilisateur\Documents\Sophie\JMP Addin\Python libs";
Python send(strPathPythonLibs);
Python submit( "
 
import sys, subprocess
 
subprocess.check_call([
    sys.executable, '-m', 'pip', 'install',
    '--no-index',
    f'--find-links={strPathPythonLibs}',
    'numpy', 'pandas', 'scipy'
])
" );
 
SophieCuvillier_1-1756455572177.png

 

 
Do you know how to resolve the issue ? I know that the sys.executable should return the path of JMP python.exe but for some reason it returns the path of jmp.exe. Where is the  python.exe used by JMP?
 
Eki
Eki
Level I

Re: How to install Python Packages manually on JMP

Hello!

Yes, sys.executable returns the path of jmp.exe instead of the Python executable which is actually located in the same directory (jmp_python.exe). But it is difficult to use it directly as some environment variables must be set before running pip.

What you could do would be to allow JMP to generate the jpip.bat file for you. This file sets all the environment variables needed in order to the pip module of JMP-Python to work properly.

Python Create JPIP CMD();

After generating the jpip.bat file (must be done only once, obviously), you can use it with additional arguments in a JSL script like this:

Run Program(Executable("cmd.exe"), Options({"/c", "\!"path/to/the/jpip.bat\!"", "install", "--no-index", "--find-links=\!"path/to/the/wheels\!"", "numpy", "pandas", "scipy"}), Read Function("text"));

Note the escaped quotation marks, your paths might contain spaces.

Alternatively, you can modify the jpip.file directly (2nd last row):

"C:\path\to\the\jmp_python.exe" -m pip install --no-index --find-links="path\to\the\wheels" numpy pandas scipy

Then you need to run the jpip.bat file only:

Run Program(Executable("cmd.exe"), Options({"/c", "\!"path/to/the/jpip.bat\!""}), Read Function("text"));



Re: How to install Python Packages manually on JMP

Thank you very much it worked ! 

Recommended Articles