License Manager Error -1 with certain python file (pyrunfile)

2 views (last 30 days)
Hello.
When I tried to use python file with pyrunfile code in Matlab workspace,
I have an error pop-up window which says there is an issue with license.
  1. I am using student license.
  2. With other python files(with simple code), it works perfectly in Matlab workspace , and I can even use it in Matlab function in Simulink.
  3. I am not sure that it is the problem with multiprocess library in python.
  4. I already re-installed the Matlab, but I still find this problem so i think it is not the problem related with license even though it says it is.
troubleshoot button gives this link :
Can you tell me what I need to do to solve this problem?

Answers (1)

Siraj
Siraj on 11 Sep 2023
Hi! It is my understanding that you are getting License Manager Error -1. As you correctly mentioned, the error you encountered is not related to a license issue. It occurs because using the "multiprocessing" Python module from MATLAB is not a supported workflow, as indicated at the following link:
However, running the following commands in MATLAB may resolve the issue:
>> [v,exe] = pyversion;
>> py.multiprocessing.forking.set_executable(exe);
The "set_executable" command will set the executable used by the Python multiprocessing module to be "exe", the Python executable.
If you observe the appearance of three Python terminals, it is because running Python scripts with python.exe typically opens a terminal upon startup, as stated on the Python website.
To suppress the terminal window and avoid multiple terminals, you can run your scripts with pythonw.exe. pythonw.exe is usually located in the same directory as python.exe. To execute your Python script using pythonw.exe within MATLAB, you can use the following commands:
>> [v, exe] = pyversion(<pythonw.exe location>);
>> py.multiprocessing.spawn.set_executable(exe);
Hope this helps.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!