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
lala
Level VIII

How can the following python library installation commands be implemented in python in a JMP environment?

Thanks Experts!

pip install selenium-wire -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install blinker==1.7.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip uninstall h11
pip install h11 -i https://pypi.tuna.tsinghua.edu.cn/simple
9 REPLIES 9
lala
Level VIII

Re: How can the following python library installation commands be implemented in python in a JMP environment?

??

Python Init();

Python Submit(
"
import subprocess
try:
    subprocess.check_call(['pip', 'install', 'selenium-wire', '-i', 'https://pypi.tuna.tsinghua.edu.cn/simple'])
    result = 'selenium-wire 安装成功。'
except Exception as e:
    result = f'安装失败:{e}'
"
);

Re: How can the following python library installation commands be implemented in python in a JMP environment?

A couple comments about the code above.

Python Init(); is unnecessary in JMP 18 and beyond.  Python is live with the first JSL Python statement run or the first script run from a Python script editor.

 

Second, for a multi-line string passed to Python Submit you can't just quote the string.  In JSL there are special characters that flag a string to be represented as a whole.

Python Submit (

"\[

import blah

# my python code here

]\");

 

Just search for Python Submit in JMP's Scripting Index to see an example.  ( Under Help menu.  Help -> Scripting Index )

 

hogi
Level XII

Re: How can the following python library installation commands be implemented in python in a JMP environment?

Python Install Packages( "selenium-wire" );
lala
Level VIII

Re: How can the following python library installation commands be implemented in python in a JMP environment?

Thanks!

OK

2024-11-07_16-55-47.png

jthi
Super User

Re: How can the following python library installation commands be implemented in python in a JMP environment?

Have you tried if jmputils's jpip is able to do those?

jthi_0-1730717279185.png

 

-Jarmo
lala
Level VIII

Re: How can the following python library installation commands be implemented in python in a JMP environment?

I know that.
It can't just do that
Thanks!

import jmputils
jmputils.jpip('install', 'selenium-wire')
jthi
Super User

Re: How can the following python library installation commands be implemented in python in a JMP environment?

Have you tried with the extra commands? The first argument in jpip should allow you to use something like

'install -i https://pypi.tuna.tsinghua.edu.cn/simple'

inside it (scripting index has example of using install --upgrade)

-Jarmo
lala
Level VIII

Re: How can the following python library installation commands be implemented in python in a JMP environment?

jthi
Super User

Re: How can the following python library installation commands be implemented in python in a JMP environment?

Have you tried dropping the --upgrade? Or moving it before -i (though I think it might be able to figure it out).

 

jthi_0-1730725431607.png

jthi_1-1730725517478.png

 

pip install - pip documentation v24.3.1

-Jarmo