How to compile a Standalone App which requires Python?

25 views (last 30 days)
I am trying to compile a Standalone App with App designer.
The goal should be that other user can open the App without having Matlab installed.
The App workes on App Designer perfectly. Even if I compile the App and open it on my computer everything runs.
However, if I open the App on an other computer (without MATLAB, Python and CoolProp) the App opens but the calculation can't be done.
I guess the problem is the missing Python and/or CoolProp on the second Computer.
My code uses this function:
rho=py.CoolProp.CoolProp.PropsSI('D','T',273.15+ T_gc_out ,'P',p_h,KM)
Is there a way to compile the App including the required Python and CoolProp software to run my programm? I want to include these files, or codes in the app such that the other users don't have to download Python and CoolProp separately.
  1 Comment
Mario Malic
Mario Malic on 23 Mar 2021
I think you could rather use websave to download Python directly to app root directory from this link, take a look at embeddable package, it's an archive file that you could unpack through MATLAB and use pyenv with input arguments to specify the location of the Python executable. Maybe you could do similarly for CoolProp, I don't know what is it.

Sign in to comment.

Answers (2)

Rashed Mohammed
Rashed Mohammed on 26 Mar 2021
Hi Giancarlo
As of R2021a, MATLAB doesn't support including external software when deploying an application automatically. However, as Mario suggested, you can try including the embeddable package of python. Note that it does not contain pip to install other packages. Hence, you also need to use the manual local installation instructions present in the CoolProp documentation.
Hope this helps
  2 Comments
Giancarlo Meccariello
Giancarlo Meccariello on 6 Mar 2023
I do not know if this still works. I am not using Matlab anymore. If you anyways are going to use Python functions, then it is maybe easier to create the UI with Python (Tkinter?) and not using the Matlab app builder.

Sign in to comment.


Giancarlo Meccariello
Giancarlo Meccariello on 29 Mar 2021
Edited: Giancarlo Meccariello on 29 Mar 2021
I found a way to do so.
I added an "install" button in my app to run
pe = pyenv
app.PyversionEditField.Value = pe.Version %to print the version of python
[v,e] = pyversion; system([e,' -m pip install --user -U CoolProp']) %to install CoolProp
it does the trick
Do you know how to run this three lines of code without having a button? I would like it to run whenever opening the app
  10 Comments
Mario Malic
Mario Malic on 5 Dec 2022
Hi @Tazura1998, MATLAB has a setenv function which could be used in your case.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!