install_blender_python_modules icon indicating copy to clipboard operation
install_blender_python_modules copied to clipboard

Error in installModule function

Open Alexxkrehmen opened this issue 6 months ago • 0 comments

This line is not working on Windows, with blender 4.5 :

subprocess.call([python_exe, "import ", packageName])

Here is a suggestion for fixing this

def installModule(packageName):
     python_exe = python_exec()
     try:
         subprocess.check_call([python_exe, "-c", f"import {packageName}"])
     except:
         # upgrade pip
         try:
             subprocess.check_call([python_exe, "-m", "ensurepip", "--default-pip"])
         except:
             pass  # ensurepip can fail if not already installed
         # install required packages
         subprocess.check_call([python_exe, "-m", "pip", "install", "--upgrade", "pip"])
         subprocess.check_call([python_exe, "-m", "pip", "install", packageName])

Alexxkrehmen avatar Jul 19 '25 03:07 Alexxkrehmen