No molule named pexpect

I followed all the steps to set up the site but I am getting the error shown above. I used Cygwin as a console here. The steps I followed were from the official ardupilot website have the link Setting up SITL on Windows — Dev documentation (ardupilot.org)

I have met the same issue.
I solved it.
Please changing a python link from python 3.9 to python 3.7.

Please check “python --version”.
If python and pip have linked to 3.9.
Delete it. and then re-link 3.7 version.

=======================================

$ python --version
Python 3.9.16

$ ls /usr/bin/py*
/usr/bin/py.test /usr/bin/pygmentize3.9 /usr/bin/python3.7
/usr/bin/py.test-3.9 /usr/bin/pyserial-miniterm /usr/bin/python3.7-config
/usr/bin/pybabel /usr/bin/pyserial-ports /usr/bin/python3.7m-config
/usr/bin/pybabel-3.9 /usr/bin/pytest /usr/bin/python3.7m.exe
/usr/bin/pydoc3 /usr/bin/pytest-3.9 /usr/bin/python3.9.exe
/usr/bin/pydoc3.7 /usr/bin/python /usr/bin/pyvenv-3.7
/usr/bin/pydoc3.9 /usr/bin/python3
/usr/bin/pygmentize /usr/bin/python3-config

$ rm -f /usr/bin/python
$ rm -f /usr/bin/pip
$ ln -s /usr/bin/python3.7 /usr/bin/python
$ ln -s /usr/bin/pip3.7 /usr/bin/pip

=======================================

@Peloton I try your solution but it doesn’t work. any other suggestion?

You can just download pexpect module in cygwin by doing
pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user pexpect
which should bypass any walls and should allow you to continue.

thanks for the reply but I am still stuck here.
image

Try doing it inside your cd ardupilot repository. If that doesn’t work, then try adding pexpect to your environment variables. It should work but for some reason it is recognizing pecpect when you run your sim_vehicle. Do you have a physical vehicle you could try?