Skip to content

Use venv for plugin dependencies#7

Open
Shrinks99 wants to merge 4 commits intomeshroomHub:mainfrom
Shrinks99:use-venv
Open

Use venv for plugin dependencies#7
Shrinks99 wants to merge 4 commits intomeshroomHub:mainfrom
Shrinks99:use-venv

Conversation

@Shrinks99
Copy link

@Shrinks99 Shrinks99 commented Mar 6, 2026

Hi there!

While trying to get this working today on Meshroom 2025.1.0, I had some issues with the package dependencies VS Meshroom's venv environment. Specifically Meshroom's version of numpy doesn't seem to play nice with what mrGeolocation needs!

Starting Process for 'Download2dMap_1'
 - commandLine: D:/Meshroom-2025.1.0/plugins/MeshroomGeolocation/.venv/Scripts/python.exe D:/Meshroom-2025.1.0/plugins/MeshroomGeolocation/scripts/download2dMap.py  --GPSFile "D:/local-photogrammetry-test/MeshroomCache/GetGPSData/e5b4044da1a9e05fb94a76fc610860d6db94f4af/gps.json" --dist 100 --layersWanted "boolBuildings,boolRoads" --roadsName False --verboseLevel "trace" --outputPath "D:/local-photogrammetry-test/MeshroomCache/Download2dMap/e01f6f1834f75da15bdc3a2e6bf917932feab9c2/map2D.obj" --outputFolder "D:/local-photogrammetry-test/MeshroomCache/Download2dMap/e01f6f1834f75da15bdc3a2e6bf917932feab9c2"
 - logFile: D:/local-photogrammetry-test/MeshroomCache/Download2dMap/e01f6f1834f75da15bdc3a2e6bf917932feab9c2\log
 - command full path: D:/Meshroom-2025.1.0/plugins/MeshroomGeolocation/.venv/Scripts/python.exe
ERROR:root:Error on node computation: Error on node "Download2dMap_1":
Log:
Traceback (most recent call last):
  File "D:\Meshroom-2025.1.0\plugins\MeshroomGeolocation\scripts\download2dMap.py", line 3, in <module>
    import generate_plane
  File "D:\Meshroom-2025.1.0\plugins\MeshroomGeolocation\scripts\generate_plane.py", line 2, in <module>
    import trimesh
  File "D:\Meshroom-2025.1.0\plugins\MeshroomGeolocation\.venv\Lib\site-packages\trimesh\__init__.py", line 12, in <module>
    from . import (
  File "D:\Meshroom-2025.1.0\plugins\MeshroomGeolocation\.venv\Lib\site-packages\trimesh\boolean.py", line 8, in <module>
    import numpy as np
  File "C:\Release\sources\Meshroom\venv\Lib\site-packages\numpy\__init__.py", line 112, in <module>
  File "C:\Release\sources\Meshroom\venv\Lib\site-packages\numpy\__init__.py", line 108, in _delvewheel_patch_1_5_2
AttributeError: module 'sys' has no attribute 'frozen_dir'

I noticed that an environment var for MESHROOM_GEOLOC_PYTHON was set up, but this wasn't noted as part of the install process. It also means Meshroom users have to start the program from the command line for the plugin to work.

Changes

I've added a venv and setup script that sets it up and installs the packages for the user. The plugin venv is used instead of Meshroom's included Python due to the -E flag when running. Now it works again! Hopefully this ensures that the plugin will continue to function in the future, even as Meshroom updates its dependencies! :)

- Setts the -E flag to tell Python to ignore `PYTHONPATH` and `PYTHONHOME` so Meshroom's injected venv path can't contaminate the subprocess's package resolution.
Should be easier to keep updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant