<div dir="ltr">Thanks,<div>In OS X following works:</div><div>subprocess.call(['pip3','install','pyxform'])</div><div><br></div><div>Does same works  works for Ubuntu/linux also?</div><div><br></div><div><br></div><div>for windows, I am assuming 'python' refers to python 3 inside QGIS3.</div><div><br></div><div><br></div><div>regards,</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div>Thanks & Regards<br>Shiva Reddy K.<br>Scientist/Engineer 'SC'<br>Indian Institute of Remote Sensing,<br>Indian Space Research Organisation<br>Department of Space<br></div>4-Kalidas Road<br></div>Dehradun<br><div><div>mobile: 8791806093<br></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jul 7, 2018 at 3:15 PM Richard Duivenvoorde <<a href="mailto:rdmailings@duif.net">rdmailings@duif.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 07/07/2018 08:11 AM, shiva reddy wrote:<br>
>     Hello,<br>
>     I tried to install automatically during my pluign (QRealTime)<br>
>     installation by calling:<br>
> <br>
>      subprocess.call(['python','-m','install','pyxform','--user'])<br>
> <br>
>     It worked many times in windows and it fails sometime.<br>
>     It don't work in OS X and I have not tested in ubuntu.<br>
> <br>
>     What is the best practice for such situation?<br>
<br>
Hi, I tried your lines here on Debian 9.4/testing/ in a python3 console:<br>
<br>
>>> import subprocess<br>
>>> subprocess.call(['python','-m','install','pyxform','--user'])<br>
/usr/bin/python: No module named install<br>
1<br>
>>> subprocess.call(['python','-m','pip','install','pyxform','--user'])<br>
/usr/bin/python: No module named pip<br>
1<br>
<br>
Ah, but with Debian we have python and python 3, so I tried:<br>
subprocess.call(['python3','-m','pip','install','pyxform','--user'])<br>
...<br>
Installing collected packages: argparse, linecache2, traceback2, six,<br>
unittest2, formencode, unicodecsv, xlrd, pyxform<br>
Successfully installed argparse-1.4.0 formencode-1.3.1 linecache2-1.0.0<br>
pyxform-0.11.3 six-1.11.0 traceback2-1.4.0 unicodecsv-0.14.1<br>
unittest2-1.1.0 xlrd-1.1.0<br>
0<br>
Works! \o/<br>
Not sure if (from within python) you can find out what the name of the<br>
python executable is...<br>
<br>
For QGIS2 we earlier recommended to just add the full module into your<br>
plugin package. (if possible, aka python-only module).<br>
<br>
There has also been discussion about using pip for python modules, by<br>
adding the 'pip install line' as a separate metadata.txt line.<br>
In that way we could either let users install it (in their global or<br>
user env), or maybe later do this programatically.<br>
<br>
There are questions/discussions/options:<br>
- how to handle clashing specific versions of the same module between<br>
different plugins<br>
- where to install modules: installation system wide, in one QGIS<br>
virtual environment (venv) or in a venv per plugin<br>
- security questions (mostly a Linux discussion: should a distribution<br>
rely on venv's or only install distribution modules)... etc<br>
<br>
Your idea is (to me) new :-)<br>
If working platform independently and full proof, I think it is an<br>
interesting option!<br>
<br>
Now with QGIS3 we have true separated profiles, we an idea would be to<br>
add a virtual environment PER profile, so all plugins can install<br>
modules in that environment (using your trick?), and in case of a clash<br>
can then create 2 profiles for those plugins/modules.<br>
Not sure though this is feasible for all OS's. I think it will be<br>
easiest on Linux...<br>
<br>
Others?<br>
<br>
Regards,<br>
<br>
Richard Duivenvoorde<br>
</blockquote></div>