Skip to content

Can't install missing dependencies in a build environment #108

Description

@pjcreath

Curiously the FreeCAD build environment knew about InventorLoader, but of course the dependencies hadn't been installed by the Addon Manager, since I installed InventorLoader in my production version of FreeCAD.

Even after adjusting the path for python, I had to split the arguments sent to subprocess.call into a list so that it could actually find the executable.

The following patch fixes the issue:

--- InitGui.py.orig	2025-11-26 16:29:18
+++ InitGui.py	2025-11-26 16:27:03
@@ -13,5 +13,9 @@
 		module = os.path.join(os.path.dirname(EmptyFile.__file__), "libs", file)
 		python = os.path.join(os.path.dirname(sys.executable), os.path.basename(sys.executable).replace('FreeCAD', 'python'))
-		subprocess.call(u"\"%s\" -m pip install \"%s\"" %(python, module))
+		if not os.path.exists(python):
+			python = os.path.normpath(os.path.join(os.path.dirname(sys.executable), "../../../.pixi/envs/default/bin/python"))
+			if not os.path.exists(python):
+				raise FileNotFoundError(f"Unable to find python interpreter: {python}")
+		subprocess.call([python, "-m", "pip", "install", module])
 
 	import os, subprocess, traceback, FreeCAD, FreeCADGui, EmptyFile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions