Sim_vehicle.py [Errno 13] Permission denied 'mavproxy.py'

I’m running SITL on a Windows 10 machine using WSL2 with ubuntu distro. When I try to run: ./Tools/autotest/sim_vehicle.py -v ArduCopter --console --map
I get the following error:
SIM_VEHICLE: Run MavProxy
SIM_VEHICLE: “mavproxy.py” “–out” “172.26.176.1:14550” “–master” “tcp:127.0.0.1:5760” “–sitl” “127.0.0.1:5501” “–map” “–console”
[Run MavProxy] An exception has occurred with command: ‘mavproxy.py --out 172.26.176.1:14550 --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --map --console’
[Errno 13] Permission denied: ‘mavproxy.py’
SIM_VEHICLE: Killing tasks
Any idea for what might be happening here?

Did you follow all of the instructions in the wiki?
https://ardupilot.org/dev/docs/sitl-on-windows-wsl.html

I did, I’ve cloned ArduPilot with recursive submodules flag and installed the dependencies with ./Tools/environment_install/install-prereqs-ubuntu.sh. Today I tried installing VcXsrv XWindows but that did not help.

I don’t know why you would see a permissions error trying to run mavproxy.py…
Maybe check to see who’s the owner of that file and whether its permissions are set correctly.

I manage to solve the issue running VcXsrv and using VSCode terminal instead of Ubuntu WSL2 terminal. I think it’s related to VSCode auto-forwarding ports from wsl to windows. Thank you for the help!

Your problem and solution don’t really appear to be related.

However, if the issue really was X forwarding, ensure you’re using WSL2 and that it is updated (via wsl —update in an elevated Powershell).

You no longer need Vcxsrv with WSL2. Windows 10/11 support X forwarding natively via WSLg.