matlab-actions / setup-matlab

Set up your GitHub Actions workflow with a specific version of MATLAB.
BSD 3-Clause "New" or "Revised" License
76 stars 10 forks source link

MATLABPyHost.exe won't start on Windows #26

Open H0R5E opened 2 years ago

H0R5E commented 2 years ago

Hi,

I've been trying to get MATLAB's 'OutOfProcess' Python support to work on a Windows runner, but I've encountered an issue that I can't get past. This is my workflow:

name: MATLAB Windows OutOfProcess Bug

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  main:
    runs-on: 'windows-latest'
    steps:
      - name: Set up MATLAB
        uses: matlab-actions/setup-matlab@v1
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.8'
      - name: Create MATLAB script
        run: |
          "pyenv('ExecutionMode', 'OutOfProcess')" | Out-File -FilePath run.m
          "py.list({'Monday','Tuesday','Wednesday','Thursday','Friday'})" | Out-File -FilePath run.m -Append
      - name: Run script
        run: matlab -batch "run"

The output from the last step is:

MATLAB is running in headless mode.  Figure windows will not be displayed.

    Sponsored License -- for use in support of a program or activity sponsored by MathWorks.
    Not for government, commercial or other non-sponsored organizational use.

Caught "std::exception" Exception message is:
Unable to launch Simple server: Unable to launch C:\Program Files\MATLAB\R2021b\interprocess\bin\win64\pycli\MATLABPyHost.exe

because: An error occurred while initializing child process:  While attempting to execute "C:\Program Files\MATLAB\R2021b\interprocess\bin\win64\pycli\MATLABPyHost.exe -mvmInputPipe 138736 0 0 0 0 0 -mvmOutputPipe 0 139588 0 0 0 0": CreateProcessW: The parameter is incorrect

ans = 

  PythonEnvironment with properties:

          Version: "3.8"
       Executable: "C:\hostedtoolcache\windows\Python\3.8.[10](https://github.com/H0R5E/matlab-actions-windows-bug/runs/5096231061#step:5:10)\x64\python.EXE"
          Library: "C:\hostedtoolcache\windows\Python\3.8.10\x64\python38.dll"
             Home: "C:\hostedtoolcache\windows\Python\3.8.10\x64"
           Status: NotLoaded
    ExecutionMode: OutOfProcess

thread_monitor::launch: _beginthreadex failed
ERROR: MATLAB error Exit Status: 0x00000001
Error: Process completed with exit code 1.

I have set up a repo just to test this issue and you can see the outcome here.

I understand that Windows support is not official, as yet, but can you offer me any advice about this issue?

Many thanks,

Mat

mcafaro commented 2 years ago

Hi Mat,

I am still investigating this issue. It does not occur locally, so it must be something unique about the way Python is installed on these agents or something unique about the agent configuration in general. I will update this issue with progress.

Best, Mark