ArduPilot / ArduPilot/ardupilot

Wrong version of python launched in `sim_vehicule.py` after installation with `environment_install` tool on Windows

Open
#23,939 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
15.9k
Forks
21.4k
Avg merge
3d 17h
Merged PRs (30d)
119

Description

Bug report

Issue details

After running the environment_install tool for Windows install-prereqs-windows.ps1, I follow the Copter SITL/MAVProxy Tutorial and running this command give me an error :

$ ../Tools/autotest/sim_vehicle.py --map --console
Traceback (most recent call last):
  File "/cygdrive/c/Users/jmaitr03/Documents/Github/ardupilot/ArduCopter/../Tools/autotest/sim_vehicle.py", line 31, in <module>
    from pysim import util
  File "/cygdrive/c/Users/jmaitr03/Documents/Github/ardupilot/Tools/autotest/pysim/util.py", line 19, in <module>
    import pexpect
ModuleNotFoundError: No module named 'pexpect'

I found that in the sim_vehicule.py script, the shebang is wrong because it says :

#!/usr/bin/env python3

python3 is a symbolic link to /etc/alternatives/python3 which is not python 3.7 (but python 3.9)

In the install-prereqs-windows.ps1 script, a symbolic link are made to python3.7 but with the name python and not python3 :

Start-Process -wait -FilePath "C:\cygwin64\bin\bash" -ArgumentList "--login -i -c 'ln -sf /usr/bin/python3.7 /usr/bin/python'"
Start-Process -wait -FilePath "C:\cygwin64\bin\bash" -ArgumentList "--login -i -c 'ln -sf /usr/bin/pip3.7 /usr/bin/pip'"

This misconfiguration causes the error shown above.

Version
Ardupilot-git

Platform
[X] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine

Hardware type
Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Tools/autotest/sim_vehicle.py and install-prereqs-windows.ps1, then reproduce the documented Windows SITL command and inspect which Python executable it selects. Done means the command uses the Python version installed by the Windows prerequisites and imports pexpect without the reported ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, python
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.