Replies: 1 comment
|
The main point is to make MATLAB use the exact Python executable belonging to the environment in which PyAEDT is installed. Do not mix the AEDT-native interpreter, an Ansys Python Manager environment, and a different Python found through PATH. First verify the chosen environment outside MATLAB. On Windows: If that import fails, install PyAEDT into that same interpreter: Then start a fresh MATLAB session and bind pyenv to the full executable path before making any py.* call: Use new_desktop=true if MATLAB should launch a separate AEDT instance instead of attaching to an existing one. If several 2025 R1 processes are running, Desktop also accepts aedt_process_id together with new_desktop=false. ExecutionMode="OutOfProcess" is a good first choice here because PyAEDT and MATLAB can load native libraries with conflicting dependencies. Once the workflow is stable, you can test in-process execution if call overhead matters. If py.sys.executable is not the executable you selected, stop there: MATLAB is still bound to the wrong environment. Also check getenv("PYTHONHOME"); a stale PYTHONHOME can override or conflict with pyenv. For AEDT 2025 R1, a Python 3.10 environment is the conservative choice. PyAEDT's installation documentation notes that AEDT 2023 R2 and later use Python 3.10 wheelhouses, while MATLAB's supported Python version still depends on the MATLAB release. References: |
Uh oh!
There was an error while loading. Please reload this page.
Is there any instruction anywhere on how to configure so that I can call Python scripts towards the EDT (2025 R1 and forward) from MATLAB? I get a lot of “library not found” errors and so on when using pyenv in MATLAB but I’m not sure how to do the configuration. I have a virtual environment defined thorough the Ansys Python Manager and then there is the native environment so I’m a little bit confused how to get all this to work together with MATLAB.
All reactions