Skip to content

fix map3d on windows - #1719

Merged
tridge merged 14 commits into
ArduPilot:masterfrom
tridge:pr-map3d-windows
Aug 1, 2026
Merged

fix map3d on windows#1719
tridge merged 14 commits into
ArduPilot:masterfrom
tridge:pr-map3d-windows

Conversation

@tridge

@tridge tridge commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

now works both in WSL2 and on native windows

tridge added 14 commits August 1, 2026 08:49
the same HOME/LOCALAPPDATA/tempdir fallback is needed by the 3D map for
its terrain tile cache
open() was called in text mode and .read() ran before the with, so the
fallback entered a str as a context manager and always raised. It is only
reached when importlib.resources fails, which is what happens in a frozen
build where the data directory is not an importable package.
HOME is not set on native Windows, so the quantized terrain tiles were
cached relative to the cwd. For an installed build that is the install
directory under Program Files, which is not writable.
vtk is a plain module that fakes a package by pointing __path__ at
vtkmodules, which pyinstaller cannot follow. The frozen Windows build
died with ModuleNotFoundError: No module named 'vtk.wx'.
MAVExplorer's pyinstaller analysis did not include mavproxy_map/data, so
both its 2D map and its 3D map failed to load loading.jpg.
without vtk and quantized-mesh-tile the released installer has no 3D map
sits below Show Map and loads the 3D map module
the viewer imports VTK in a child process, so with the packages absent the
child died where nobody could see it and idle_task quietly dropped the map.
find_spec keeps VTK out of the parent process.
the existing guard wrapped the map3d import, but map3d.py does not import
VTK, so a missing vtk never raised there
the modpaths loop falls back to a bare module name, and its 'No module
named X' was overwriting the real failure from the MAVProxy.modules path
a distro opencv is built against one numpy major version, so pulling in a
newer numpy leaves cv2 unimportable and the map failed to load with no clue
why. MAVProxy itself keeps running either way.
quantized-mesh-tile requires numpy>=2, which leaves a distro opencv or
matplotlib built against numpy 1 unimportable, taking out the 2D map and
the graphs. The floors are needed because pip leaves an unpinned
requirement alone when the distro build already satisfies it.
keeping the first error stopped the fallback bare module name reporting
'No module named X' over the real reason, but it also hid the reason an
external plugin failed. A ModuleNotFoundError naming the modpath we tried
only says that path does not exist, so let a later attempt replace it.
find_spec only catches packages that are absent, not a VTK or wx that is
installed but unusable, and the child's stderr goes nowhere when MAVProxy
is started from a GUI. wx raises SystemExit rather than an Exception when
it cannot open the display, so catch that too.

Also point at the MAVProxy[map3d] extra: 'pip install vtk
quantized-mesh-tile' pulls numpy>=2 without the opencv and matplotlib
builds to match, which breaks the 2D map on older distros.
@tridge
tridge merged commit b957705 into ArduPilot:master Aug 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant